Test your payment buttons
To ensure that your PayPal Payments Standard payment buttons work correctly, PayPal recommends that you test them using the PayPal Sandbox before you place them on your live website.
|1.||Create sandbox accounts.|
|2.||Create test buttons in the sandbox.|
|3.||Test buttons on your website.|
Create sandbox accounts
Log in to the Developer site at https://developer.paypal.com.
On the Dashboard tab, navigate to Sandbox > Accounts.
Click Create Account and populate the following fields:
Country The country of the merchant or buyer test account. Account type Personal or Business. Email address
A real or fake email address. The sandbox does not send any email outside of the sandbox environment. Email to sandbox accounts, generated as a result of your test API requests, appear on both the Notifications tab on the Developer site, and on the sandbox test site.
Use the assigned email value to reference this test account in your test API calls, and to log in to the sandbox site to review the details associated with the account.
Password The password. Must be from eight to 20 alphanumeric characters long. Use the password to log in to the sandbox test site. First and Last names Optional. The name fields accept only alphabetic characters. PayPal balance Optional. It is a good idea to create test accounts with positive bank balances. Enter an integer value between 1 and 10 Million. Bank Verified Account Create both Verified and Unverified test accounts to fully test your application. Select Payment Card Discover or PayPal.
(US Personal accounts only.)
Credit card type Optional. A credit card type. The sandbox associates a mock credit card number with the account. Notes Details for this test account.
Click Create Account.
Use the client ID to get an access token.
Create test buttons in the sandbox
Use your test seller credentials to log in to the PayPal Sandbox.
To create your payment buttons in the sandbox:
- Click Profile > Profile and Settings. Then, click My Selling Tools.
- Click Paypal Buttons.
- Under Related Items on the right, click Create new button.
- Choose a button type and fill out the form to create your test button.
- Click Create Button to generate the HTML for your test button. For detailed instructions, see Create a payment button.
This example shows the HTML for a simple Buy Now test button:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="6RNT8A4HBBJRE"> <input type="image" src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_buynow_107x26.png" alt="Buy Now"> <img alt="" src="https://paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form>
Copy the button code to the appropriate location on your website. For detailed instructions, see Copy and paste button code.
This page shows how it might look on your web page:
<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <title>Testing a PayPal Payments Standard Button</title> </head> <body> <h2>Buy Strings!</h2> <table> <tr> <td>Bass Guitar Strings</td> <td> <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="6RNT8A4HBBJRE"> <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> </td> </tr> </table> </body> </html>
Test buttons on your website
- Open your web page in a browser and click on the PayPal payment button.
- When prompted to log in on the PayPal payment page, log in with your test buyer account credentials for the sandbox.
- Under Sandbox in the PayPal Developer Dashboard, click Notifications.
- Verify that you have received email notifications for your transactions.