This document provides a comprehensive guide for integrating with PayU Hosted Checkout or v2 Non-Seamless using the v2/payments API. The hosted checkout integration allows you to redirect customers to PayU's secure payment page, minimising PCI compliance requirements while providing a seamless payment experience.
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
The v2/payments API request contains the following main 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)
result JSON Object fields description
Field
Description
Example (from your response)
mihpayId
Unique transaction ID assigned by PayU. Use for future reference, inquiry, or refund.
21612493009
bankReferenceNumber
Bank reference number for the transaction (provided by bank on success).
"2411194544"
amount
Actual amount involved in the transaction.
10.00
mode
Payment mode used (e.g. CC = Credit Card, DC, UPI, NB).
"CC"
requestId
Unique identifier for the request (e.g. for refund or other follow-up requests).
""
originalAmount
Original transaction amount before any additional charges or discounts.
10.00
additionalCharges
Any additional charges applied to the transaction.
0.00
discount
Discount amount applied to the transaction.
0.00
netDebitAmount
Total amount debited from the payer’s account after additional charges and discounts.
10.00
productInfo
Short description of the product or service for which the payment was made.
"Test Product"
firstName
Payer’s first name.
"John"
bankcode
Code of the bank or payment instrument used (e.g. VISA, MAST, AMEX).
"VISA"
nameOnCard
Cardholder name; null if not captured.
null
cardNo
Masked card number.
"XXXXXXXXXXXX1234"
cardType
Type of card (e.g. VISA, MAST, AMEX).
"VISA"
udf1 – udf5
User-defined fields for optional merchant data.
null (all)
field2
Context-specific information from the bank (e.g. codes or values used for verification).
"140455"
field9
Transaction status or message from the bank/gateway.
"Transaction is Successful"
errorCode
Error code; E000 typically means no error.
"E000"
errorMessage
Human-readable error message; “No Error” when successful.
"No Error"
addedOn
Timestamp when the transaction was initiated.
"2024-11-19 21:17:55"
settledAt
Timestamp when funds were settled; 0000-00-00 00:00:00 if not yet settled.
"0000-00-00 00:00:00"
paymentSource
Source/channel of payment (e.g. WEB, payuS2S, express).
"WEB"
pgType
Payment gateway type (e.g. CC-PG for card, UPI-PG for UPI).
"CC-PG"
status
Overall transaction status (e.g. success, failure, pending).
"success"
unmappedStatus
Internal PayU status (e.g. captured, failed, auth, pending).
"captured"
merchantUTR
Merchant’s Unique Transaction Reference; null if not provided.
null
rupayAuthRefNo
RuPay-specific authorization reference; null for non-RuPay.
null
authRefNo
Bank/gateway authorization reference number.
"123456789"
threeDSVersion
Version of 3D Secure used (e.g. 2.2.0).
"2.2.0"
message
General status or result message (e.g. “Found TxnId”).
"Found TxnId"
txnId
Merchant-provided transaction/order ID used for tracking.