Search code examples
paypalcredentialsbearer-tokenclientcredential

PayPal bearer resets after x amount of seconds


I’m using PayPal refund api. The api docs says the bearer token that I am using will reset after x amount of seconds.

Link to where it says access token resets: https://developer.paypal.com/reference/get-an-access-token/

In my case my token resets after 9 hours. I am using this token to refund purchases which will happen all the time. Is there an alternate solution from Bearer <Access-Token> that doesn’t include a reset token? I haven’t been able to find one other than the Basic <client_id>:<secret> which includes client credentials which doesn’t seem to work. And yes the credentials are correct.

Link to api: https://developer.paypal.com/docs/api/payments/v2/#captures_refund


Solution

  • Basic client_id:secret, where the string client_id:secret is Base64 encoded, is the header value for HTTP Basic Authentication. This is used to obtain an access token from the oauth2 token endpoint.

    Access tokens expire after 9 hours, beyond which a new one must be obtained. These are required for all PayPal REST API operations, including refunds.