search

POSTgetAccessToken API

Use Case

Merchant can use this API to get the access token corresponding to an Auth Code (received from the App side in the earlier step). For the same merchant, the backend needs to make an S2S call with Paytm backend. This token can be used to fetch the user details in the getUserInfo API.

Request Attributes

Content Type : JSON

Head

AttributeDescription
Authorization
string
mandatory

This is a base64 encoded string of “clientId:clientSecret”

Example: bWVyY2hhbnQtYWJjOm1lcmNoZW50LXNlY3JldA==
[ This is Base64 of merchant-abc:client-secret ]

Body

AttributeDescription
code
string
mandatory

Auth code you get in response from paytmFetchAuthCode bridge

Example: rwtw-fsdfk-vcvx-tweq

grant_type
string
mandatory

authorization_code

Example: authorization_code

client_id
string
mandatory

Client ID provided during onboarding your Mini Apps

Example: merchant-abc

scope
string
mandatory

scope of the Mini Apps

Example: basic

Response Attributes

Head

ATTRIBUTE DESCRIPTION
status

status of response

Example: 200

Success

PARAMETER DESCRIPTION
scope

scope of the Mini Apps

Example: basic

access_token

access token of the user sent by Paytm

Example: 7522b293-cad6-4ed8-bdc6-7c3bc3637100

expires

expiration time

Example: 1570465786000

resourceOwnerId

Resource owner ID

Example: XXXXXX

Error Responses

PARAMETER DESCRIPTION
error

error name

Example: Internal error

error_description

error message

Example: Something went wrong

Error Codes

STATUS ERROR
400 Internal Error
400 unsupported_grant_type
400 invalid_grant
401 NO RESPONSE BODY
⇾
UAT
Production
https://accounts-uat.paytm.com/oauth2/v2/tokencopy icon
REQUEST
RESPONSE
CURL
JAVASCRIPT
curl -X POST 'https://accounts.paytm.com/oauth2/v2/token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --header 'cache-control: no-cache' \
  --header 'Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l' \
  --data 'grant_type= authorization_code&code=rwtw-fsdfk-vcvx-tweq&client_id=merchant-abc&scope=basic'
copy icon