post
https://test-accounts.payu.in/oauth/token
The GetToken API obtains an OAuth bearer token for Partner Onboarding APIs. Call this first (Step 00); use the returned access_token as Authorization: Bearer {token} on all later steps.
HTTP Method: POST
Environment
| URL | |
|---|---|
| Test Environment | https://test-accounts.payu.in/oauth/token |
| Production Environment | https://accounts.payu.in/oauth/token |
Sample Request
Sample request
curl --location 'https://test-accounts.payu.in/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id={{client_id}}' \
--data-urlencode 'client_secret={{client_secret}}' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=refer_merchant'Sample Response
Success scenario
{
"access_token": "7b5843b39e5532bc...",
"token_type": "Bearer",
"expires_in": 7199,
"scope": "refer_merchant",
"created_at": 1723498499
}Failure scenario
- 401 Unauthorized — Invalid
client_idorclient_secret
{
"error": "invalid_client",
"error_description": "Client authentication failed"
}- 400 Bad Request — Invalid
grant_typeorscope
{
"error": "invalid_request",
"error_description": "Missing or invalid grant_type"
}Response Parameters
Response parameters
| Parameter | Description | Example |
|---|---|---|
| access_token | string — Bearer token for subsequent Partner API calls | 7b5843b39e5532bc... |
| token_type | string — Always Bearer | Bearer |
| expires_in | integer — Token validity in seconds | 7199 |
| scope | string — Granted OAuth scopes | refer_merchant |
| created_at | integer — Unix timestamp when the token was issued | 1723498499 |
Request Parameters
Header parameters
| Header | Description | Example |
|---|---|---|
Content-Typemandatory | string — Must be application/x-www-form-urlencoded | application/x-www-form-urlencoded |
Body parameters
| Parameter | Description | Example |
|---|---|---|
client_idmandatory | string — Partner OAuth client ID (from PayU KAM) | a1b2c3... |
client_secretmandatory | string — Partner OAuth client secret | d4e5f6... |
grant_typemandatory | string — Must be client_credentials | client_credentials |
scopemandatory | string — Space-separated scopes (include refer_merchant) | refer_merchant |
400Bad Request
401Unauthorized - Invalid or expired token
403Forbidden - No access to this resource
404Not Found
422Validation Failed
500Internal Server Error
