Bhanu
Bhanu

Reputation: 3

how to integrate Paypal Express checkout using new method?

I want to integrate PAYPAL EXPRESS CHECKOUT in my project. I think PAYPAL has upgraded the APIs and its methods. I downloaded REST API from Github but I am not able to figure out how to integrate it. All i get is confused. Because in that REST zip I downloaded there are so many files and I was not able to understand how can i integrate express checkout with the new API and method. Also I have gone through many of the sites with the examples but as soon as I execute them I get an error 10001. Please help.

Upvotes: 0

Views: 865

Answers (1)

Nils Ziehn
Nils Ziehn

Reputation: 4331

I am not sure, whether you still need this, but you should read this document:

PayPal Docu

When using the REST Api, you don't have to download anything! Basically how it works is: You have to have a developer account, create one here: Dev Account

There you should get your client_id and secret.

Then you have to connect to this URL

https://api.sandbox.paypal.com/v1/oauth2/token

With http headers:

"Accept": "application/json",
"Accept-Language":"en_US"

With auth set to

YOUR_CLIENT_ID:YOUR_SECRET

Replace the values above with the client_id and the secret you got from the docu.

And finally the parameters (params):

"grant_type":"client_credentials"

The example of this given in the docus is using curl:

curl -v https://api.sandbox.paypal.com/v1/oauth2/token \
  -H "Accept: application/json" \
  -H "Accept-Language: en_US" \
  -u "EOJ2S-Z6OoN_le_KS1d75wsZ6y0SFdVsY9183IvxFyZp:EClusMEUk8e9ihI7ZdVLF5cZ6y0SFdVsY9183IvxFyZp" \
  -d "grant_type=client_credentials"

( Note how they changed client_id and secret! )

Ofc you can also do this in nodejs or php etc.!

The response is a json-object, from which you need the response.content.access_token !

This will be used later to access the other APIs.

For all the further steps, check out the docu AND check out this request generator:

Request generator

Upvotes: 1

Related Questions