The latest PayPal API requires you set up a set of API keys for both live and testing (Sandbox).
PayPal REST API Credentials
To get started with the PayPal REST API, you need to create a developer account on the PayPal Developer Dashboard.
PayPal provides two environments, Sandbox and Live. Sandbox environment allows developers to test the PayPal checkout process before making it Live for production usage. You can create sandbox Business and Personal accounts from the Sandbox Accounts section.
In the PayPal Developer Dashboard, you can switch between the Sandbox and Live environment from the toggle button placed at the top-right corner.
Create Sandbox Accounts:
- Sandbox Merchant Account: Create a sandbox business account with Account type: Business. This merchant account is required to attach at the time of the REST API app.
- Sandbox Buyer Account: Create a sandbox buyer account with Account type: Personal. This buyer account will be used to test payment.
- After the sandbox buyer account creation, an email ID and password will be generated. You can use these credentials to log in at the time of testing the PayPal checkout.
Create REST API App:
In the Apps & Credentials section, create a new REST API App with Type: Merchant.
- Select a business account under the Sandbox Account dropdown.
After the App creation, the Client ID and Secret will be generated.
- Copy these API credentials to later use in the script.
Live REST API Credentials:
At the top right corner, toggle the switch to Live. Then navigate to the Apps & Credentials section.
- Create a new REST API App, you will get the credentials (Client ID and Secret) for the Live environment.