This lesson will outline the best practices for working with dynamic info, being passed back from your Buyer.
Concept of a Response Token
Response tokens are used to parse a Buyers response from a lead post. Response Tokens utilize regex to "match" a Buyers parameter, to be stored for the Price, Redirect URL, or Lead ID.
When trying to match a Buyers parameter, most often you will use "(.*?)" which is considered the Lazy Match.
When making response tokens, its best to copy the Buyers response to ensure that parameter in the token will match your Buyers parameters.
Since Buyers responses can vary, the lazy match may not work. Here is an example where the lazy match alone, will not match - please see below.
Example Buyers Response:
Example Response Token:
The example above is escaping invalid regex characters. The "[" and "]" are invalid, so to escape them "\" precedes the invalid regex characters.
Any time CAKE Basic sees a Price response token, the Buyer Contract is considered "Dynamic Price". Meaning that the schedule price will be used, rather you get the price dynamically form the Buyer.
Response Token: Price>(.*?)</Price
Note: When a Buyer Contract is dynamic price, it will NOT fallback to the Delivery Schedule price. If a price is not received on a Success, the price received will be 0.
Redirect URL Token
A Redirect URL is best described as the a dynamic end location that your Buyer wants the end user redirected to. Normally these Redirect URLs are dynamic per user. Meaning user 1 goes to http://redirectURL1.com, but user 2 goes to http://redirectURL2.com.
Response Token: URL>(.*?)</URL
Lead ID Token
Lead ID Token, is the only response token that will be used if a lead is NOT sold to a Buyer Contract.
The Buyers lead id is a field you can view in the Buyers Report(Lead Gen > Reports > Buyer), so if you ever get feedback from a Buyer, you can use this ID to be on the same page as your Buyer.
Response Token: lead_id>(.*?)</lead_id
XML Decode Response Tokens
When CAKE Basic responds back with the values that were captured in the response tokens it is considered 'literal'.
Meaning if your Buyer has a XML encoded version, that is what CAKE Basic is going to redirect to.
Since XML encoding will not redirect successfully, this setting will XML decode the response, to ensure that the Redirect URL will redirect successfully.