Knowledge Base - 2Checkout - Can I specify the return URL on the fly?
Like

Can I specify the return URL on the fly?

Answer:

Yes, this is possible. You may pass in a parameter called 'x_receipt_link_url' to control where the customer is returned to on a per-sale basis. Keep in mind that this parameter will override the Approved URLs set in your account. Using this method, you could create a special button or link that would return the customer to a different page on your site than is set at the Product level or set up on the Site Management page. This is useful for ‘promotional’ type sites as you can avoid having to make any configuration changes to your actual account.

If you are using buttons on your site to sell your goods through 2Checkout, you would add a single line to the button such as this:

<input type=”hidden” name=”x_receipt_link_url” value=”http://www.your-site.com/return.php”>

This must go between the opening and closing form tag that you see when you view your existing code.
 

If you are using links to sell your goods through 2Checkout, then you would add this parameter to your links to specify the approved URL, such as this:

&x_receipt_link_url=http://www.your-site.com/return.php

Notice that in both of the above examples, the FULL path is used for the value of this.

Important Notes: The 'x_receipt_link_url’ parameter will only function on Live accounts.  This option will not work on the Sandbox environment.

Additionally, for security reasons, the domain on your account and the domain that hosts the pass back page must match exactly for this to work correctly. For example, if you have http://www.your-site.com specified on your account, you could pass back to http://www.your-site.com/pages/pass.php but not to http://www.your-other-site.com/pages/pass.php.


EXAMPLE 1 - HTML FORM:

Let's use an example Plug and Play form generated from the HTML snippet area of your 2Checkout account:

<form action='https://www.2checkout.com/checkout/purchase' method='post'>
    <input type='hidden' name='sid' value='1793985'>
    <input type='hidden' name='quantity' value='1'>
    <input type='hidden' name='product_id' value='1'>
    <input name='submit' type='submit' value='Buy from 2CO' >
</form>
<span>2Checkout.com Inc. (Ohio, USA) is a payment facilitator for goods and services provided by company.</span>

Next, we will add the x_receipt_link_url parameter to this form (the parameter can go anywhere in between the <form> open and </form> close tags (line added in red):

<form action='https://www.2checkout.com/checkout/purchase' method='post'>
    <input type='hidden' name='sid' value='1793985'>
    <input type='hidden' name='quantity' value='1'>
    <input type=”hidden” name=”x_receipt_link_url” value=”http://www.your-site.com/return.php”>
    <input type='hidden' name='product_id' value='1'>
    <input name='submit' type='submit' value='Buy from 2CO' >
</form>
<span>2Checkout.com Inc. (Ohio, USA) is a payment facilitator for goods and services provided by company.</span>


EXAMPLE 2 - HTML LINK:

Let's use an example Plug and Play link generated from the HTML snippet area of your 2Checkout Account

<a href='https://www.2checkout.com/checkout/purchase?sid=1863930&quantity=1&product_id=1'>Buy Now</a>
<span>2Checkout.com Inc. (Ohio, USA) is a payment facilitator for goods and services provided by company.</span>

Next, we will add the x_receipt_link_url parameter to this link (Added in red):

<a href='https://www.2checkout.com/checkout/purchase?sid=1863930&quantity=1&product_id=1&x_receipt_link_url=http://www.your-site.com/return.php'>Buy Now</a>
<span>2Checkout.com Inc. (Ohio, USA) is a payment facilitator for goods and services provided by company.</span>


For more information continue reading:

How the Return Process Works

Why are my Buyers being Returned to the Wrong URL?

Was this article helpful?

Your feedback helps us improve our site.

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255