Specify several areas in the PayPal RequestPermission request API

Looking at the request API , he says the area should be a string. However, I was not able to figure out how to specify several areas (e.g. EXPRESS_CHECKOUT and REFUND). Comma-separated, half-colony, and even using their NVP list syntax do not work. It would be helpful to evaluate the CURL sample.

Example with commas ...

curl -s --insecure -H "X-PAYPAL-SECURITY-USERID: API_USERNAME" -H "X-PAYPAL-SECURITY-PASSWORD: API_PASSWORD" -H "X-PAYPAL-SECURITY-SIGNATURE: API_SIGNATURE" -H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" -H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" -H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" https://svcs.sandbox.paypal.com/Permissions/RequestPermissions -d "requestEnvelope.errorLanguage=en_US&scope=EXPRESS_CHECKOUT,REFUND&callback=http://my/callback" 

When I make this request, I go back to "Invalid request parameter area with EXPRESS_CHECKOUT, REFUND"

+6
source share
2 answers

Ok Found an answer randomly. Scope variables must be set using "scope (0) = SCOPE_1 & scope (1) = SCOPE_2 ..."

So, the cURL request will look like this:

 curl -s --insecure -H "X-PAYPAL-SECURITY-USERID: API_USERNAME" -H "X-PAYPAL-SECURITY-PASSWORD: API_PASSWORD" -H "X-PAYPAL-SECURITY-SIGNATURE: API_SIGNATURE" -H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" -H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" -H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" https://svcs.sandbox.paypal.com/Permissions/RequestPermissions -d "requestEnvelope.errorLanguage=en_US&scope(0)=EXPRESS_CHECKOUT&scope(1)=REFUND&callback=http://my/callback" 
+9
source

If you use your JSON API, the scope may be an array.

+3
source

Source: https://habr.com/ru/post/920594/


All Articles