create buynow button for sandbox account

STUART GRAY picture STUART GRAY · Mar 28, 2013 · Viewed 12.7k times · Source

I'm new to paypal development and am trying to create a BuyNow button in the sandbox to enable me to test my application in a non production environment. If I create a button from my normal account it directs me to the live paypal site but if I try to create a button in the sandbox, the button creation page is always on the live box and I can't find anyway of creating a button in the sandbox using sandox test accounts, that then allows me to make test payments in the sandbox. Please help.

Answer

PP_MTS_Chad picture PP_MTS_Chad · Mar 28, 2013

The link in the sandbox is broken and redirects you to the live site. When this happens, sometimes you can just add sandbox into the URL to correct the issue. So if you click the button and it takes you to https://www.paypal.com/button/blah_blah, you would just need to change it to https://www.sandbox.paypal.com/button/blah_blah. Another option would be to create a non hosted clear text button from your live paypal account and then just modify the URL to point to the sandbox instead of the live site. So instewad of the following:

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">

You woudl just change it to

<form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">

And then you would update the business variable to reflect the email address of your test sandbox seller account.

The last option for creating a button, would be not to log into your account but use the BMCreateButtom API call. Keep in mind this could be a little bit more work then you may want to do if you are only familar with HTML.