Contact Us!Subscribe to Blog and RetireFollow Blogandretire on TwitterBlog and Retire on Facebook

Redirect Buyers to Your Site After PayPal Purchase

PayPal is the most used merchant system online. If you choose to use PayPal as your payment processor (which makes everything way easier) you may want to learn a few secrets that will optimize your PayPal experience as a seller.

It seems like PayPal wants to keep a few things a secret. I don’t know if that’s the case, but it’s possible that the two secrets I’m going to unveil could make PayPal more money if these secrets were kept.

The first secret is how to redirect buyers back to your website after they have purchased an item from you through PayPal. (The second secret will be in a later post, so come back to find out!)

By default, PayPal redirects your customers back to PayPal after they have completed payment on your product. However, there is a way to redirect your customers back to the url of your choice and it is a two-step process.

1. Turn Auto Return On

Here are the steps to turn Auto Return on:

Login to your PayPal account.

Hover your mouse over Profile, then scroll down and click on More Options.

On the right-hand side, click My selling tools

Under Selling online, go down to Website Preferences and click Update (on left-hand side).

Under “Auto Return for Website Payments,” click the option for Auto Return to “On”

Next, type in the default url you wish to lead your customers to, if you don’t specify a url in your paypal button code. (However, no matter what, PayPal will redirect your customers back to PayPal if you don’t add the below html code to your finished button code. You have to have auto return On and you also have to add the code below to your paypal button code.)

Go down to the bottom of the page and click “Save”.

2. Add the Proper Redirect Code to Your PayPal Button Code

First of all, when creating your buy button (or whatever button you choose), “Step 3″ will give you the option to “Take your customers to this URL when they finish checkout”. Check that box and input the url you wish to send your customers to once they have finished payment.

Second, you need to add the following code somewhere in your PayPal button html code they give you:
<input name=”return” type=”hidden” value=”http://www.yourwebsite.com/yoursuccesspage” />

Change the type in red to whatever your url actually is.

Then input that line of code into your PayPal button code anywhere on it’s own line. For example, here is an entire code, and I included the extra code you need to add in purple:

<form action=”https://www.paypal.com/cgi-bin/webscr” method=”post”>
<input name=”cmd” type=”hidden” value=”_s-xclick” />
<input name=”hosted_button_id” type=”hidden” value=”1AAAA111AAA1A” />
<input name=”return” type=”hidden” value=”http://www.yourwebsite.com/yoursuccesspage” />
<input alt=”PayPal – The safer, easier way to pay online!” border=”0″ name=”submit” src=”http://www.yourwebsite.com/image.gif” type=”image” />
<img alt=”” border=”0″ height=”1″ src=”https://www.paypalobjects.com/en_US/i/scr/pixel.gif” width=”1″ /></form>

That’s it! Now your customers will be redirected to the url of your choice when they have finished payment.

Just remember PayPal’s rules when redirecting to your own url after payment:
redirect_buyers_back_to_site_after_paypal_purchase

Did You Enjoy This Post?

No spam. Powered by MailChimp.

12 Responses to 'Redirect Buyers to Your Site After PayPal Purchase'

  1. cw says:

    Great tip, and a way to extend its functionality – if you’ve needed a way to save purchase information in your database, have the return URL be a script and put your sale data in the query string. Works like a charm. (of course then have the script redirect to a Thank You message).

  2. cw says:

    Thanks Lisha, one detail worth pointing out is that PayPal uses the Javascript reserved word “return” as a variable identifier, which violates the ECMAScript 5.1 standard and will throw an error in Internet Explorer if you try to manipulate it with code (other browsers seem to tolerate it).
    For example, I’m using the return URL with a query string to enter variables into my database after the PayPal transaction. IE doesn’t like the statement

    document.forms[0].return.value = ‘myURL?item=sweater”;

    and it breaks the page code.

    Echh. Just when it seemed so easy…

    • Lisha says:

      Thank you CW for that tip. Do you know how to solve this issue? Do any of you other readers know how to solve this with IE? Thanks!

      ~Lisha

  3. Artur says:

    Is there any way to set the time after the link to download the product expires ?

    • Lisha says:

      hmmm. Haven’t thought about that. I usually just make my downloads last indefinitely… I’ll look into it.

  4. Rahul says:

    I don’t think you need to add the “input name=”return” type=”hidden” in the Paypal code. You just save the button and Paypal does the redirection automatically.

    • Lisha says:

      Actually, in my experience, paypal has not redirected my buyers to the success page after payment unless I do include that extra code. So just to be safe, I add that code every time. It only takes two seconds, so there’s no reason for me not to. It would be a bigger headache if my customers weren’t redirected to the success page after payment, because almost every time I need to get their email at least so I can get their info, or send them what they purchased.

  5. Kay says:

    Here’s a helpful post on the warrior forum about redirecting buyers back to your site after a paypal purchase.

    http://www.warriorforum.com/programming-talk/635473-paypal-redirect-after-payment.html

  6. Does this resolve the problem of Paypal not redirecting after a nonmember (not having a Paypal acccount) pays with a Visa or Mastercard. This looks like a failsafe in case that IPN request doesn’t happen. Thoughts?

  7. Yes, this “sometimes” option of redirecting to the download page in Paypal is unacceptable. Your answer here (the additional button coding option) seems to indicate reliability of the redirect going through one way or another.


Member Login | Blog | Services | Advertise Here | Terms | Privacy Policy | Disclaimer | Disclosure | Contact