What should I consider when going from the Sandbox to Live PayPal with hosted buttons?
You can create and store buttons on our site on the PayPal buttons page. These hosted buttons have a hidden variable, hosted_button_id. This ID number points to a particular button and is unique to a specific PayPal account.
Button examples
The following example shows code for an unencrypted button. The business variable line (in red) shows how our system determines which account to credit the payment to. If you use this example, ensure that your business email address is the same as your live PayPal account email, not your sandbox account email.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="seller@business.com">
<input type="hidden" name="item_name" value="testing_handling">
<input type="hidden" name="item_number" value="test">
<input type="hidden" name="amount" value="0.01">
<input type="hidden" name="handling" value="0.01">
<input type="hidden" name="shipping" value="0.01">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt=" border="0" src="pixel.gif" width="1" height="1"> <input type="hidden" name="add" value="1"
</form>
The following example is the code for a hosted button, with the hosted_button_id line in red.
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="353581">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt=">
<img alt=" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Moving from Sandbox to Live
A hosted button created in the sandbox doesn't necessarily have the same value for hosted_button_id as one created in live. Once you're ready to go live with your integration, you must create new hosted buttons in the live environment.
Otherwise, payments could be credited to another PayPal account, or if the hosted_button_id value isn't found in our database, the buyer may get an error when they click the button.