getAccessToken API
Use Case
Using this API merchant can get the access token corresponding to a Auth Code (received from the App side in earlier step). For the same merchant backend needs to make a S2S call with Paytm backend. This token can be used to fetch the User details in the getUserInfo API.
Request Attributes
API Content format: JSON
Head
ATTRIBUTE | DESCRIPTION | MANDATORY |
---|---|---|
Authorization | This is a base64 encoded string of “clientId:clientSecret” | Yes |
Body
ATTRIBUTE | DESCRIPTION | EXAMPLE |
---|---|---|
code | authorization_code | authorization_code |
grant_type | Auth code you get in response from paytmFetchAuthCode bridge | rwtw-fsdfk-vcvx-tweq |
client_id | Client ID provided during onboarding your Mini Appschant-abc | |
scope | scope of the Mini Apps | Basic |
Response Attributes
Head
ATTRIBUTE | DESCRIPTION | EXAMPLE |
---|---|---|
status | status of response | 200 |
Success:
PARAMETER | DESCRIPTION | EXAMPLE VALUE |
---|---|---|
scope | scope of the Mini Apps | paytm |
access_token | access token of the user sent by paytm | 7522b293-cad6-4ed8-bdc6-7c3bc3637100 |
expires | expiration time | 1570465786000 |
resourceOwnerId | Resource owner ID | XXXXXX |
Error Responses:
PARAMETER | DESCRIPTION | EXAMPLE VALUE |
---|---|---|
error | error name | Internal error |
error_description | error message | 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/token
REQUEST CODERESPONSE CODE
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=mmerchant-
abc&scope=basic'