PayPal is a well-known online payments processor that enables money transfers for companies and regular users alike.
Paypal’s API enables users to create apps that interact with their accounts, automating operations that pertain to billing, invoicing, orders, payments and many other elements.
In this tutorial, you will learn how to connect the PayPal REST API to Google Sheets in 5 steps:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new
To use the PayPal REST API, you have to create a dedicated app in your Paypal account. You can create either a sandbox app, used for testing, or a live app that uses the actual information in your account.
In this tutorial we will use a live app, to show you how you can import actual live information from Paypal into your Google Sheets. Here’s the steps:
1.) Log in to your PayPal Developer Dashboard, using the same log in information as your Paypal account. If you don’t yet have a Paypal account, you can create one by clicking on the Sign Up button:
2.) Once logged in, click on My Apps & Credentials and toggle the switch to the Live option, to start creating a live app (Paypal may prompt you to upgrade your account to a business account):
3.) After clicking “Live”, scroll down, and in the REST API apps section, click Create App. Then type a name for your app and then click Create App again:
4.) Your new app’s details page will open and display the app’s identifying information. Copy and save the Client ID and Secret for your app somewhere safe and get ready to use them in the next step.
5.) Review your app’s information and for the purposes of this example, make sure that the Transaction Search option is checked, before saving your app:
In order to access most PayPal REST API endpoints, you will need an access token. To obtain an access token, you’ll either need to do a cURL command or use the Postman app.
Click here for instructions on using the Postman app.
Here’s the instruction for cURL:
To make a cURL command, pass your OAuth 2.0 credentials through a dedicated PayPal REST API command, using the cURL command line tool (command prompt window for Windows OS or a terminal for Mac OS):
curl -v https://api.paypal.com/v1/oauth2/token \ -H "Accept: application/json" \ -H "Accept-Language: en_US" \ -u "CLIENT_ID:SECRET" \ -d "grant_type=client_credentials"
Note: For Mac OS you may need to use single quotes ( ‘ ) instead of double quotes ( ” ).
Use the same values for Client ID and for Secret that you copied in the previous step, into the CLIENT_ID and SECRET placeholders you see above.
Note: If the token/key that you generate has an expiration time, you will need to complete this same process again to get a new token when the old one expires.
You can also use other command-line tools besides cURL, but for those, you’ll have to set the Accept header to application/x-www-form-urlencoded instead of application/json.
In response to this command, the PayPal authorization server will return your access token in the access_token field of the JSON result:
{ "scope": "<scope>", "access_token": "<Access-Token>", "token_type": "Bearer", "app_id": "<App-Id>", "expires_in": 31349, "nonce": "<nonce>" }
Copy the access token somewhere safe because you will need it in the next step.
Note: This JSON result also contains an expires_in field, containing the number of seconds after which your newly-retrieved access token expires. For instance, access tokens with a value of 3600 in the expires_ field will expire in one hour from the time the response was generated, meaning you will need to get a new access token if it’s been longer than an hour.
Back in the Google Sheet, at the top of Apipheny add-on, select your HTTP method (GET or POST) as required by your API endpoint. For this example we are using GET.
Next, enter your URL for a PayPal REST API endpoint into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query.
Here’s a list of available Paypal API parameters you can use.
For this example, we will use the Transaction Search API to get your PayPal account’s transaction history. This example URL uses the GET HTTP method and includes a number of parameters: start_date, end_date, fields, page_size and page.
https://api.paypal.com/v1/reporting/transactions?start_date=2020-03-10T00:00:00-0700&end_date=2020-03-24T23:59:59-0700&fields=all&page_size=100&page=1
See the screenshot below to see the URL in Apipheny.
After you enter the API URL into Apipheny, we’re going to enter some keys and values into the Headers section.
In the Headers section in Apipheny, you should add two rows with the following keys and values:
Header 1 Key 1: Content-Type Value 1: application/json
Header 2 Key 2: Authorization Value 2: Bearer your-access-token
It doesn’t matter what order the headers are entered. Replace your-access-token with the value from the access_token field in the JSON response you obtained in Step 3. Enter the access token after “Bearer”, with a space between “Bearer” and the token (see screenshot below).
The Content-Type and Authorization headers are also required, so you should add them as their own header:
Click the Run button at the bottom of the Apipheny sidebar and then wait for the Paypal API data to be retrieved and added in to your Google spreadsheet, like this:
In this example, we got our Paypal transaction history data in Google Sheets by using the Apipheny add-on.
Now that you know how to query the Paypal API, try using different parameters in your Paypal API URL. Click here to see a list of available parameters.
Keep in mind that the access token you obtained expires after an hour, so you’ll need to get a new access token if it’s been more than an hour.
Make a GET request
Make a POST request
PUT, PATCH, & DELETE Requests
Save requests for later
Schedule requests for automatic updates
Reference cell values in requests
=APIPHENY custom function
Stack multiple URLs in a single request
Run all saved requests at once
Modify your request settings
Import & export saved API settings
Ahrefs API
Airtable API
Alpha Vantage API
Asana API
Binance API
Clickup API
Coingecko API
Coinmarketcap API
Coinbase API
Constant Contact API
Discord API
Drift API
Etsy API
Eventbrite API
Facebook Graph API
Facebook Ads API
Figma API
Github API
Google SERP API
Hubspot API
Hunter API
What is an API?
What is an API URL?
What are parameters?
What is an endpoint?
What is an API key/token?
What is basic authentication?
What are headers?
What is a GET request?
What is a POST request?