PG Load API

The PG Load API allows you to create a credit transaction entry through a payment gateway.

Environment

HTTP Method: POST

Request Headers

This API uses HMAC-SHA512 authentication on the header.

Parameter Description
walletIdentifier
mandatory
String Program Type (e.g., CLW)
date
mandatory
String GMT formatted date (e.g., Thu, 17 Feb 2022 08:17:59 GMT)
Authorization
mandatory
String HMAC-SHA512-based authentication token
Content-Type
mandatory
String application/json
↩️

If you do not post the authentication, you will get error in response. For the list of error codes, refer to Status Codes

hmac authentication logic

hmac username="smsplus", algorithm="sha512", headers="date", signature="7ff938849aa79265a3de63fe241dfecb1c680f58c6d11e9f9ca08512afea374705eb9f8995ef6c4584e16eca2e1dc688262bb0937a36cc0f75ec22a9eea33523"

Where, the fields in this example are:

  • username: The merchant key of the merchant.
  • algorithm: This must have the value as hmac-sha512 that is used for this API.
  • headers: This must have the value as date digest.
  • signature: This must contain the hmacsha512 of (signing_string, merchant_secret), where:
  • signing_string: It must be in the "date: {dateValue}"format. Here, the dateValue is the same values in the fields listed in this table For example, "date: Thu, 17 Feb 2022 08:17:59 GMT"
  • merchant_secret: The merchant Salt of the merchant. For more information on getting the merchant Salt, refer to Generate Merchant Key and Salt.

Request Parameters

ParameterDescriptionExample
clientTxnId
mandatory
Alphanumeric(14) Unique transaction ID for this requestReload_V3_1234
requestDateTime
mandatory
Numeric(14) Timestamp of the transaction (YYYYMMDDHHMMSS format)20230822183015
customerId
optional
Numeric(20) A unique customer ID from calling application to be shared. If the value is not passed in the request, the platform will auto-generate a unique value for this
field."
89342546
customer.firstName
mandatory
String(50) Customer first Name. The following validations for this field : 

  1. Start and end with valid characters (no extra characters outside the allowed set). 

  2. Contain only: 
 Uppercase letters (A-Z) 
 Lowercase letters (a-z) 
 Periods (.) 
 Spaces ( ) 
 Have at least one character and no invalid symbols like numbers, special characters outside the allowed set, etc.
  3. Total length of string should be max 50 chars (including space) and it can only contain characters, hyphens and single spaces in b/w words. No double spaces allowed b/w 2 words
Ashish
customer.lastName
mandatory
String(50) Customer last name. The following validations are done for this field:

  1. Start and end with valid characters (no extra characters outside the allowed set).
  2. Contain only: 
 Uppercase letters (A-Z) 
 Lowercase letters (a-z) 
 Periods (.) 
 Spaces ( ) 
 Have at least one character and no invalid symbols like numbers, special characters outside the allowed set, etc.
  3. Total length of string should be max 50 chars (including space) and it can only contain characters, hyphens and single spaces in b/w words. No double spaces allowed b/w 2 words
Mishra
customer.mobileNumber
mandatory
Numeric(13) Customer's mobile number with country code919988776655
customer.email

mandatory
String(50) Valid Email address with valid email format[email protected]
surl
mandatory
String This is the URL to which customer is redirected incase if PG Transaction
is a success
https://pp1admin.payu.in/test_response
furl
mandatory
String This is the URL to which customer is redirected incase if PG Transaction
is a failure
https://pp1admin.payu.in/test_response
currency
mandatory
String Currency code of the currency used.INR
loadAmount
mandatory
Numeric(12) Amount to load (expressed in implied decimals)1500
seamlessTransaction
mandatory
String Identifier if it is a seamless transaction or non seamless. This must be either true or false, where:
  • false indicates it is a non-seamless transaction.
  • trueindicates it is a seamless transaction.
false

Response Parameters

ParameterDescriptionExample**
referenceIdReference ID of Transactione47293311906aeb0eb65168adacdce01
data.redirectUrlRedirection link"https://pp1api.payu.in/public/#/e47293311906aeb0eb65168adacdce0"
seamlessTxnIdentifier if it is a seamless transaction or non seamlesstrue/false

Sample Request

curl --location --request POST 'https://apitest.payu.in/loyalty-points/ppi/payment/pg-load/v1' \ 
--header 'walletIdentifier: CLW' \ 
--header 'date: Wed, 12 Jun 2024 08:53:43 GMT' \ 
--header 'authorization: hmac username="smsplus", algorithm="sha512", headers="date", signature="v15rnvh1InSEWRq6EW9BCfXlxO0QI/4Sxxmdxd2f4Q0="' \ 
--header 'Content-Type: application/json' \ 
--data-raw '{  
"clientTxnId": "testRegistration10",  
"requestDateTime": "20230620123143",  {
 "customer": {
 "firstName": "FGHJ",
 "lastName": "DFTTYUI",
 "email": "[email protected]",
 "mobileNumber": "919999999999"
 },
 "surl": "https://pp1admin.payu.in/test_response",
 "furl": "https://pp1admin.payu.in/test_response",
 "currency": "INR",
 "loadAmount": 4100,
 "customerId": "2201919",
 "seamlessTxn": false
 }

Sample Response

{ 
"referenceId": "e47293311906aeb0eb65168adacdce01", 
"data": { 
       "redirectUrl": "https://pp1api.payu.in/public/#/e47293311906aeb0eb65168adacdce0"
}, 
"seamlessTxn": false
}

HTTP Status Codes

Status CodeDescription
200OK - Request processed successfully
400Bad Request - Invalid request parameters
401Unauthorized - Authentication failed
404Not Found - Wallet not found
500Internal Server Error

Error Codes

Error CodeDescription
1081Load transaction successful
1010Invalid message code
1020Missing required parameters
1040Wallet not found
1050Transaction limit exceeded