Test and go live
When you’re ready to take your integration live, use this page to move your integration from your test environment to your live production environment.
Know before you code
Complete the steps in Get started to get your sandbox account information from the Developer Dashboard:
- Client ID
- Access token
- Business account credentials
- Personal account credentials
1. Test your integration
Complete end-to-end testing in your sandbox to make sure the entire integration functions as you expect.
Test REST API requests and responses
During your development, use the sandbox API base URL,
https://api-m.sandbox.paypal.com/, so you can safely test all the REST API requests without affecting live PayPal accounts.
Log into the sandbox test site,
sandbox.paypal.com, to see the result of a REST API call that creates an action in a PayPal account, such as creating an order or an invoice.
Test the Checkout flow
Use your personal sandbox login information during the checkout flow to complete a transaction and then log into the sandbox test site,
sandbox.paypal.com, to see the money movement out of the buyer's account.
Use the business sandbox login information to log into
sandbox.paypal.com to see the money move into the merchant's account.
Learn more about the PayPal sandbox: PayPal sandbox.
As you're testing your APIs and flows, refer to the following sections, which provide tips for testing specific integration functionality. Use what applies to your integration and skip those that don't.
Use the following tools to test payments in the sandbox.
|Payment method||Tool||Why use it?|
|PayPal button||Personal sandbox account||The personal sandbox account information in the Developer Dashboard contains account login information you can use in the checkout flow for a test purchase.
Sandbox test accounts
|Credit card||Credit card generator||The credit card generator quickly creates card information you can use in checkout flow or in a REST API integration to test a purchase.
Credit card generator
|Alternative payment method||Simulation server||The simulation server runs the APM experience on the sandbox and allows you to add mock buyer information to test the APM flow. To add mock buyer information, click the pre-fill button available after you select an APM in the checkout flow. You can also simulate successful authorizations or failed authorizations.|
|PayPal pay later offers||Personal sandbox account||The personal sandbox account information in the Developer Dashboard contains account login information you can use in the checkout flow for a test purchase.
Sandbox test accounts
Use the following methods to test webhooks in your integration:
|Testing method||Why use it?|
|Developer Dashboard||After you subscribe to a webhook, confirm the event triggered by the webhook displays on the Sandbox > Webhooks Events page.
Sandbox webhooks events
|On your listener URL||Confirm your listener URL received the webhook when you completed a test transaction.|
|In your webhook handler||Run any tests that you've developed for your webhook handler script to confirm code updates you've made for handling the webhook.|
Idempotent API requests
Occasionally, network outages or other service issues can disrupt REST API requests. Use Idempotent API requests to retry a request multiple times without creating a duplicate action. Enable API idempotency by using the
PayPal-Request-Id headers in the
POST calls that support it.
Make sure you test the calls that you want to be idempotent to ensure they don't create duplicate actions.
Error handling and simulation testing
Make sure all API errors are handled correctly. In addition to your tests, you can use our test scenarios to trigger different flows in your integration and make sure they're handled appropriately for customizations you’ve made. We provide test scenarios for the following APIs:
- Simulation tests — The full list of test scenarios
- HTTP status codes — The common HTTP status codes PayPal REST APIs can return
- API reference — Each API reference topic contains an Error messages section that lists the errors specific to the API, for example, Orders REST API error messages
2. Go live with your integration
Deploying your code to the live environment takes only a few steps.
- Change the base URL for all your REST API calls from
Change the references to your sandbox API credentials to the live credentials. To get live API credentials, create a live REST API.
- If you created or updated pages on a website, move that code from the test environment to the live environment.
- If you completed the advanced credit and debit card integration, complete the PayPal production onboarding for your live PayPal account.
Once your code is live, you can:
Test the button and movement of funds using real (non-sandbox) PayPal accounts. When making a live test purchase, consider:
- The business account receiving money can’t also make the purchase.
- If you create a personal account with the same information as the business account, those accounts might experience restrictions.
- Test any other integrations such as the creation of invoices or completion of payouts.