Getting Started
Disclaimer This is a portfolio sample. Please keep in mind that:
The sole purpose of this page is to showcase my understanding and practice of API documentation.
This content is not made from scratch. It is based on the publicely available official PayPal REST APIs documentation.
I focused on demonstrating a practical and user-friendly workflow on a best-effort basis.
This is content is intentionally incomplete and MUST NOT be used for production projects.
If you need a comprehensive documentation, please check the available official PayPal REST APIs documentation.
Before starting to use PayPal's REST APIs, you need to get your client ID and client secret as described in the following steps:
Go to the Dashboard and log in or sign up.
Select Apps & Credentials.
Select Create App to create a new project. &#xNAN;Note: New accounts come with a Default Application in the REST API apps section.
Copy the client ID and client secret for your app.
Getting Your Access Token
Prerequisites
Curl installed.
After successfully getting your client ID and client secret, you can generate an access token by completing the following steps:
Open a text/code editor.
Copy and paste the following code:
Now modify the code by replacing:
CLIENT_IDwith your client ID.CLIENT_SECRETwith your client secret.
Encode
CLIENT_ID:CLIENT_SECRETin Base64 before sending it in the API call.Run the updated code in your command line.
PayPal will return a response containing the access token and the number of seconds the access token is valid, as shown in the following JSON code:
Available languages You can call the PayPal OAuth API in any language.
Making API Calls
After successfuly getting an access token, you can start making API calls. Just replace ACCESS-TOKEN with your access token in the authorization header as follows:
-H Authorization: Bearer ACCESS-TOKEN.
When your access token expires, run again the previous curl code to request a new access token:
About PayPal Sandbox Account Credentials
The PayPal sandbox is a test environment that mirrors real-world transactions. By default, PayPal developer accounts have 2 sandbox accounts:
a personal account for buying
a business account for selling.
You'll get the login information for both accounts. Watch sandbox money move between accounts to test API calls.
To get sandbox login information for business and personal accounts complete the following steps:
Log into the Developer Dashboard.
Select Testing Tools > Sandbox Accounts.
Locate the account you want to get credentials for and select ⋮.
Select View/Edit Account to see mock information such as the account email and system-generated password.
Sign in to sandbox.paypal.com/signin using your personal sandbox credentials.
In a separate browser, sign in with the business sandbox credentials.
Make API calls with your app's access token to see sandbox money move between personal and business accounts.
Additional sandobox accounts You can create more sandbox accounts by selecting Create account.
Last updated