Search code examples
paypalsandbox

Testing Paypal Buy Now in Sandbox


I'm building a Paypal (business account) 'Buy Now' button into a website and am having various problems testing this with the sandbox.

I'm not saving the Buy Now button in Paypal because I need to specify the amount dynamically, though, if this proves to be the cause of any of my problems, I can find ways round that. I've set my Paypal preferences to Auto Return ON, Payment Data Transfer ON and the Return URL is set in the preferences.

What I am trying to achieve is that the user selects their purchase option and clicks 'Buy Now', this passes to the Paypal payments page where they enter their credit card details (most often) and confirm the payment and then this is returned to my return page where I grab all the details using the 'tx' variable and associated processing.

The problems I've got using the sandbox are as follows.

  1. When I click the buy button the payments page is different from that in real life. It doesn't provide the capability to pay by credit card other than by setting up a Paypal account. Why is this and is there anything I can do about it? I would like the sandbox to reflect the real situation!

  2. If I try to go down the line of paying using 'Create a Paypal Account' I get total rejection with it telling me that I can't use a credit card number or an email address which is already known to paypal. This is supposed to be a test environment! I'm not using a number or email address which is known within my accounts so how am I supposed to use this feature?

  3. Having made a payment the sandbox doesn't take me straight back to my return page and I have to click on a link to return. In fact I can't even click on this return link unless I've specified the return URL in the button code - it's just not there! I've read in this forum from a year ago that the return parameter must NOT be supplied but either way, it's not returning automatically. If this reflects how it will work in real life then I need to rethink the design totally! Is this just because I'm running in the sandbox or is there some other cause?

  4. When I do click on the link to get to the return page, I'm not getting the 'tx' variable passed to me. I'm using PHP for the return and phpinfo() shows nothing of value! Have I missed setting something somewhere?

I've read pretty much everythng I can find about the Buy Now button and the sandbox and feel that it really shouldn't be this hard! Any pointers would be greatefully received. The first couple of problems are less important but getting the return and communication going is vital!


Solution

  • 1) When using Payments Standard, the options you'll see on the PayPal pages are cookie based. If any user on the machine in use has ever signed into a PayPal account the system will assume they have an account and can simply sign in. Clearing your browser cache and cookies will generally solve this, but only for that very next attempt, of course. If you want to always force the option for Guest Checkout (credit card without PayPal account) you'll need to use Express Checkout.

    2) The cc number or email you're using must be associated with a sandbox account already. These are all managed from your developer.paypal.com account.

    3) Did you setup Auto-Return and PDT in your actual sandbox seller account? This needs to be done separate from your live PayPal account. The sandbox accounts are all treated as their own account and need to be configured accordingly.

    4) Again, it sounds like you must not have PDT enabled for the actual sandbox seller account you're working with.