Monday, 17 August 2020

how to get paypal access token

i'm trying to get access token from the paypal but the documentation uses curl https://developer.paypal.com/docs/business/get-started/#exchange-your-api-credentials-for-an-access-token and i don't know about curl. i tried doing thisapp.get("/token", async (req, res) => {try {const a = () =>{ await axios.post("https://api.sandbox.paypal.com/v1/oauth2/token", {        headers: {          Accept: "application/json","Accept-Language": "en_US","content-type": "application/x-www-form-urlencoded",},        auth: {          username: process.env.PAYPAL_CLIENT_ID,          password: process.env.PAYPAL_SECRET,},        params: {          grant_type: "client_credentials",},})}    console.log(a);    res.send();} catch (e) {    console.log(e);    res.send(e);}});but i doesn't work. i spent all night to figure this but i can't.

Submitted August 17, 2020 at 10:06PM by Raju_rapper

No comments:

Post a Comment