Reporting with Paypal API in Google Script
fondationphardy
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Nov-03-2018
06:51 AM
I am using Google script (with Google Spreadsheet) in order to access reporting (list of transactions) with Paypal API.
I managed to get a token using this function :
function getPaypalToken(){ var client_id = "..."; var secret = "..."; var options = { method: "post", headers : { "Authorization" : " Basic " + Utilities.base64Encode(client_id + ":" + secret), "Accept": "application/json", "Accept-Language": "en_US" }, payload: {"grant_type": "client_credentials"} }; var request = UrlFetchApp.fetch("https://api.paypal.com/v1/oauth2/token", options); var result = JSON.parse(request) return result.access_token; }
I check every box into my app preference (live section) :
But when I try that code, I get a PERMISSION_DENIED error...
var token = getPaypalToken() var headers = { 'Authorization': 'Bearer ' + token, }; var options = { "method" : "get", "headers": headers, }; var request = UrlFetchApp.fetch("https://api.paypal.com/v1/oauth2/token/userinfo?schema=openid", options) var result = JSON.parse(request)
THANK YOU for your help !
0 REPLIES 0
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Update your phone validation for Australia in PayPal Payments Standard
- Error when payment done. Inline events violates Content Security Policy directive. in PayPal Payments Standard
- Can't make live credential API calls in production because of partner program in Sandbox Environment
- Paypal doesn't acknowledge we received IPN in PayPal Payments Standard
- CSP in SDKs