Skip to content

PayPal returning with ?=Return+To+Merchant

Just a quick post since I had a really tough time finding an answer to a problem I was having.

I’m working on an open source eCommerce site where photographers can upload image galleries and have their clients view (and order) them. For now, I’m going to be using PayPal as the payment gateway. It was all working out fine, except for one thing.

After I went through the entire payment process in the PayPal Sandbox, instead of redirecting back to the page and query string I specified, it was redirecting to example.com/index.php?=Return+To+Merchant.

In case you’ve never set up PayPal as a payment gateway, you create a form with several hidden input fields to pass along the information that PayPal needs to complete the transaction; sales tax, shipping, item names, etc. One of the variables is called return, and it lets you tell PayPal where to send the visitor after a successful transaction – Thanks for ordering, that type of page.

Well, this site is PHP based and uses query strings, although I may do some sort of .htaccess mod_rewrites before all is said and done. The return variable was set to example.com/index.php?pa=paypalconfirm. But PayPal redirected to example.com/?=Return+To+Merchant, obviously not what I was after.

After skimming through around a hundred pages trying to find what I was after, I found another variable to use that determines how PayPal returns data back to your page. It’s the rm variable, and it defaults to 1 which means GET. Seems the GET data and my query string were at odds and causing problems. I added the rm field and changed its value to 2 and everything appears to be working.

Here’s the link where I actually found that the rm variable was what I was after.

Published inInternetProgramming

5 Comments

  1. Steve Steve

    Thanks a ton! I was having the same problem with our software. Your suggestion worked like a charm.

    -Steve

  2. thanks alot. This drove me crazy. I called paypal about it wondering what was going on and no one could give me an answer. Thank goodness for Google and people like yourself. thanks again

  3. Thank you so much for posting about this. I worked all day on a script for users to download MP3’s from a client site – I had all the databases, login systems, etc set up and then when I went to do the last thing…. test it across PayPal I got the same thing you did and thought my last 12 hours had been wasted on nothing! This was the perfect fix!

Leave a Reply

Your email address will not be published. Required fields are marked *