How to retrieve PayPal REST Api access-token using node

后端 未结 5 646
一向
一向 2021-02-10 09:03

How to get the PayPal access-token needed to leverage the REST Api by using node?

5条回答
  •  天涯浪人
    2021-02-10 09:29

    Here is how I get the access_token using superagent

            superagent.post('https://api.sandbox.paypal.com/v1/oauth2/token')
            .set("Accept","application/json")
            .set("Accept-Language","en_US")
            .set("content-type","application/x-www-form-urlencoded")
            .auth("Your Client Id","Your Secret")
            .send({"grant_type": "client_credentials"})
            .then((res) => console.log("response",res.body))
    

提交回复
热议问题