How do I correctly refresh expired access tokens when calling the Payments API?

How do I correctly refresh expired access tokens when calling the Payments API?

To refresh expired access tokens when calling the Payments API, follow these steps:

  1. Use the Refresh Token Grant of OAuth 2.0.
  2. Ensure you have a valid refresh token.
  3. Send a POST request to the Create Access Token endpoint with grant_type set to ‘refresh_token’ and include the refresh token.
  4. The API will return a new access token and refresh token.
  5. Store the new tokens securely.
  6. Use the new access token for subsequent API calls.
    If the refresh token is expired, redirect the user to Maya Connect’s URI to generate a new authorization code and exchange it for a new access token.

For Sandbox concerns and other technical implementation inquiries, please get in touch with us via:

  • Sandbox Health Page: Check real-time service status updates.
  • Maya Developer Hub Service Desk: File
    a ticket in Sandbox.

To Know More:

We value your input and would love to hear your insights. Please submit you feedback here.

Hello @low_atlas,

It looks like the AI-generated response contained some inaccuracies. Here’s the correct information for your reference.

Given that you are using access tokens to execute payments, it appears that you are referring to Payments via Maya Mini App. To refresh expired tokens in Maya Mini App, follow these steps:

  1. Use the Refresh Token Grant of OAuth 2.0.
  2. Ensure you have a valid refresh token.
  3. Send a POST request to the Create Access Token endpoint with grant_type set to ‘refresh_token’ and include the refresh token.
  4. The API will return a new access token and refresh token.
  5. Store the new tokens securely.
  6. Use the new access token for subsequent API calls.

Your Mini App shall monitor the expiry of the customer tokens (accessToken and refreshToken ), and keep these tokens valid or updated when the customer is active in your Mini App.

To know more, refer to Manage Mini App Session: Expired Customer Session

Thanks!