Get Access Token
| Environment | HTTP Method | API |
| UAT | POST | https://api.phonepe.com/apis/apphub/v5/service/auth/access |
| Production | POST | https://api.phonepe.com/apis/apphub/v5/service/auth/access |
This service gives a merchant the access token corresponding to a grant token. This token can be used to fetch the User details in the getUserDetails API
Request Headers
| Header Name | Header Value |
Content-Type | application/json |
Authorization | O-Bearer <merchant-auth-token> |
X-CLIENT-ID | Unique MID(shared by Phonepe) needs to be sent as a parameter unless a different value is shared by PhonePe team. In case of aggregator, please send AppuniqueID in the header |
Sample payload for Base64
{
"grantToken":"GRTe098bd540176757ybbnhu879125ebec723741c5189f6a4e303f2b9d28d3e4d1289bd61dd"
}
Sample Request
{
"request": "ewoJImdyYW50VG9rZW4iOiJHUlRlMDk4YmQ1NDAxNzY3NTd5YmJuaHU4NzkxMjVlYmVjNzIzNzQxYzUxODlmNmE0ZTMwM2YyYjlkMjhkM2U0ZDEyODliZDYxZGQiCn0="
}
Request Parameters
| Parameter Name | Type | Description | Mandatory |
grantToken | STRING | Unique grantToken generated by the call to fetchAuthToken as mentioned in the last section fetchAuthToken ] | Yes |
Response Parameters
| Parameter Name | Type | Description |
success | BOOLEAN | Success status of the request |
code | ENUM | See list of response codes below |
data | Object | The data object that has to be passed to the sdk. |
Response Codes
| Code | Description |
UNAUTHORIZED | The grantToken provided is either invalid or not mapped to the merchant. |
BAD_REQUEST | Invalid request payload |
AUTHORIZATION_FAILED | Incorrect Authorization header |
INTERNAL_SERVER_ERROR | Something went wrong |
API_RATE_LIMIT_REACHED | If the API call limit is breached then HTTP status code 429 would be sent |