Set a redirect URL for default checkout flows
2Checkout supports the seamless transition of shoppers to a web page of your choosing following order completion. Shopper redirect will only happen after the order is placed successfully.
All 2Checkout accounts.
2Checkout bypasses the Thank You page (finish.php) completely and no longer displays it to shoppers. If you use analytics code in finish.php be aware that it will no longer collect data.
Please note that setting up a Redirect URL and effectively redirecting shoppers to a different webpage after they place an order cancels any AfterSale Messages that you might have set up. 2Checkout displays AfterSale Messages in the Thank You page, at the end of the purchase process, but the Redirect URL causes the process to bypass the Thank You page and sends shoppers directly to the web page of your choosing.
Instant Delivery in finish.php
By redirecting shoppers to a different webpage after they place an order effectively cancels Instant delivery (in the Thank you page).
Instant delivery takes place in the Thank you page, at the end of the purchase process, but Redirect URL causes the process to bypass the Thank You page altogether, and sends shoppers directly to the web page of your choosing.
2Checkout always redirects shoppers:
- If they use an instantaneous payment method (including when they purchase paid trials).
- When payment is not required (order value is 0).
2Checkout does not redirect shoppers when they:
- Use an offline payment method such as bank/wire transfer.
- When they order free trials.
Configure the Redirect URL
To configure the Redirect URL, make your way to the Sales Links area of the Control Panel.
- Click Generate Links under Setup, and select the Default flows tab. Alternatively, you can also hit the Get buy links for this product link under the Information tab, just to the right of the Product ID, when editing a product.
- Scroll down to the Advanced Options section and locate the Additional options area. Enter the URL for the destination to which shoppers will be redirected once they finalize payments for orders they place through the 2Checkout system.
- Once you entered all desired details, scroll down to the bottom of the page and click the Generate link button. The Buy Link created will contain a &BACK_REFparameter just as in the example below. The URL following the &BACK_REF parameter is the same as the one entered under the Redirect URL field in the Additional options area.
- While you can use the Control Panel to ease the introduction of the Redirect URL into Buy Links for your products, you can also enter it manually. Just introduce &BACK_REF= http%3A//www.YourCustomRedirectURL.com into the Buy Link and replace YourCustomRedirectURL with the actual name of the custom web page where shoppers will be redirected.
In order to increase security and avoid BACK_REF tampering from 3rd party entities (security breaches), we added the possibility to include the parameter SECURE_CART.
In order to obtain a more secure and hashed URL, the SECURE_CART parameter must be used and set to value ‘1’ ( SECURE_CART=1) along with the hashed value of the BACK_REF parameter, according to this documentation.
The new URL might look like:
- The 2Checkout platform will perform this action by default for links generated in the Merchant Control Panel and will generate the PHASH value for you.
- Parameter BACK_REF should be used in clear (raw, not coded) in the PHASH calculation (ex: &BACK_REF=http://www.YourCustomRedirectURL.com/), but should be encoded when adding it to the URL (ex: &BACK_REF=http%3A%2F%2Fwww.YourCustomRedirectURL.com%2F).
- Parameter SECURE_CART should not be taken into consideration when calculating the PHASH.
Validate 2Checkout redirects
2Checkout generates the ctrl parameter automatically and adds it to Buy Links when you use BACK_REF.
ctrl is an HMAC (keyed-hash message authentication code) MD5 code enabling you to validate that the redirect was generated by 2Checkout. The code is generated using the length of the characters of the redirect URL, concatenated with the redirect URL.
STRING for HMAC_MD5 calculation
129 represents the length of the sequence of parameters.
Secret key for this example
Resulting ctrl parameter value