The PayU v2 Payment API enables merchants to process payments through a hosted checkout flow where customers are redirected to PayU's payment page to complete the transaction.
📘
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
Force a transaction with a specified method (e.g., CC, DC).
CC
createOrder optional
A flag to store the order details (true/false).
true
txnS2sFlow optional
For defining seamless/non-seamless flows in handling payments.
nonseamless
Sample Request
📘
Plugin for Development Environment:
PayU provides plugin for VS Code and IntelliJ IDEA development environment for faster integration. For more information, refer to Plugins for Development Environment.
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.