The PayU v2 Payment API enables merchants to process payments through a hosted checkout flow for TPV integration.
📘
Note: This documentation covers the non-seamless (hosted checkout) integration. For seamless payment flows, refer to the v2 Payment API (Seamless) documentation.
The current date and time. For example, format of the date is Wed, 28 Jun 2023 11:25:19 GMT.
authorization
The actual HMAC signature generated using the specified algorithm (sha512) and includes the hashed data. For more information, refer to authorization fields description.
authorization fields description
Field
Description
username
Represents the username or identifier for the client or merchant, for example smsplus.
algorithm
Use SHA512 algorithm for hashing and send this as header value.
headers
Specifies which headers have been used in generating the hash, for example date.
signature
The HMAC signature generated using the specified algorithm. For more information, refer to hashing algorithm.
hashing algorithm
You must hash the request parameters using the following hash logic:
Where <Body data> contains the request body posted with the request.
Sample header code
var merchant_key = 'smsplus';
var merchant_secret = 'izF09TlpX4ZOwmf9MvXijwYsBPUmxYHD';
// date
var date = new Date();
date = date.toUTCString();
// authorization
var authorization = getAuthHeader(date);
function getAuthHeader(date) {
var AUTH_TYPE = 'sha512';
var data = isEmpty(request['data']) ? "" : request['data'];
var hash_string = data + '|' + date + '|' + merchant_secret;
var hash = CryptoJS.SHA512(hash_string).toString(CryptoJS.enc.Hex);
return `hmac username="${merchant_key}", algorithm="${AUTH_TYPE}", headers="date", signature="${hash}"`;
}
Request parameters
Parameter
Description
Example
accountId mandatory
String Merchant key provided by PayU. Character limit: 50
"smsplus"
txnId mandatory
String Unique transaction ID for the transaction. Character limit: 50
"REF_123456789"
order mandatory
Object Order details containing product information and pricing. For more information, refer to order object
This parameter contains the status message of the transaction.
status
This parameter returns the status of web service call. The status can be any of the following:
`0` - If web service call failed.
`1` - If web service call succeeded.
result
This parameter contains the payment status details in a JSON format including payment ID of the transaction. For more detailes, refer to the result JSON Object fields description table (next accordion)
Array
(
[txnId] => b5f2d8785768087678fm9
[mihpayId] => 1999110000001769
[message] => Please call verify api to get the transaction status
)
Verify Payment
⚠️
Important: After creating a payment, you must call the Verify Payment API to get the final transaction status. The initial payment creation response will typically show "PENDING" status.
Updated 8 months ago
Updated 8 months ago
Ask AI
Beta
Hi! I am an AI Assistant. Ask me about PayU and get help with your integration.