The Get Token API returns the authentication token generated using the client ID and client secret.
Environment
| Test | https://uat-accounts.payu.in | 
|---|---|
| Production | https://accounts.payu.in | 
Additional information for request parameters
Parameters  | Description  | 
|---|---|
client_id  | For getting your client ID, refer to Get Client ID and Secret from Dashboard  | 
client_secret  | For getting your client secret, refer to Get Client ID and Secret from Dashboard  | 
scope  | The scope that must be used for payment links are: 
  | 
grant_type  | This parameter contains a constant value used to get the access token. The grant_type used across the partner integration is client_credentials.  | 
Response parameters
| Parameter | Description | 
|---|---|
| access_token | The access token to be used in Partner Integration APIs. | 
| token_type | The token type of the access token. | 
| expires_in | The expiry time in seconds of the access token. | 
| scope | The scope of the access token. | 
| created_at | The UNIX time stamp when the access token was created. | 
Note:The expiry period of the token generated using this API is configurable by you (partner). The expiry period (in seconds) of the token is displayed in the expires_in parameter of the response. For example, in the following response, the value of the expires_in is 7200 seconds:
{ "access_token": "82c38b64e072f3d64da6e4e6efee9789ffe1250f0cd04c20753d6e6f25df9cc7", "token_type": "Bearer", "expires_in": 7200, "scope": "send_sign_in_otp", "created_at": 1595411399 }
Sample request
curl -X POST https://uat-api.payu.in/merchant/credentials \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "client_id=YOUR_CLIENT_ID&username=YOUR_USERNAME&password=YOUR_PASSWORD"Sample response
Success scenario
{
  "status": "success",
  "message": "Credentials validated successfully",
  "timestamp": "2024-10-29T12:04:28Z",
  "merchant_id": "MERCHANT_12345"
}Failure scenarios
- Invalid Client ID
 
{
  "status": "error",
  "message": "Invalid client_id format",
  "error_code": "CLIENT_001",
  "timestamp": "2024-10-29T12:04:28Z"
}
- Missing Client ID
 
{
  "status": "error",
  "message": "Missing required parameter: client_id",
  "error_code": "PARAM_001",
  "timestamp": "2024-10-29T12:04:28Z"
}