1. API Integration
To integrate with PayU Hosted Checkout, you need to send a request and check the response. This will redirect the customer from the merchant’s website to PayU’s payment page to complete the payment. You can use the sample request and response in the provided documentation to get started.
The steps involved in PayU Hosted Checkout integration are:
- Prepare the request parameters
- Hash the request and post to PayU
- Check the response from PayU
- Verify Payment
Step 1: Prepare the request parameters
Make the transaction request to the PayU Test server.
Tip: When the customer is redirected to the PayU payment page, you can enforce certain payment modes or drop categories. For more information on customizing the payment codes and categories, refer to Enforce Pay Method or Remove Category.
Post request syntax & composition
The code block is a sample post request that you need to send to PayU:
<body>
<form action="https://test.payu.in/_payment" method="post">
<input type="hidden" name="key" value="JP***g" />
<input type="hidden" name="txnid" value="t6svtqtjRdl4ws" />
<input type="hidden" name="productinfo" value="iPhone" />
<input type="hidden" name="amount" value="10" />
<input type="hidden" name="email" value="[email protected]" />
<input type="hidden" name="firstname" value="Ashish" />
<input type="hidden" name="lastname" value="Kumar" />
<input type="hidden" name="surl" value="https://apiplayground-response.herokuapp.com/" />
<input type="hidden" name="furl" value="https://apiplayground-response.herokuapp.com/" />
<input type="hidden" name="phone" value="9988776655" />
<input type="hidden" name="hash" value="eabec285da28fd0e3054d41a4d24fe9f7599c9d0b66646f7a9984303fd6124044b6206daf831e9a8bda28a6200d318293a13d6c193109b60bd4b4f8b09c90972" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
The Collect Payment (_payment) API is used for collecting payments in Web Checkout integration. For request and response, refer to Collect Payment API - PayU Hosted Checkout under API Reference.
Environment
Test Environment | <https://test.payu.in/_payment> |
Production Environment | <https://secure.payu.in/_payment> |
Error Handling: If any error message is displayed with an error code, refer to Error Codes to understand the reason for these error codes.
Reference: To handle redirect URLs (surl and furl), refer to Handling the Redirect URLs.
Request parameters
Parameter | Description | Example |
---|---|---|
keymandatory
|
String Merchant key provided by PayU during onboarding.
|
JPG****.k |
txnidmandatory
|
String The transaction ID is a reference number for a specific order generated by the merchant.
|
ypl938459435 |
amountmandatory
|
String The payment amount for the transaction.
|
10.00 |
productinfomandatory
|
String A brief description of the product.
|
iPhone |
firstnamemandatory
|
String The first name of the customer.
|
Ashish |
emailmandatory
|
String The email address of the customer.
|
[email protected] |
phonemandatory
|
String The phone number of the customer.
|
|
lastnameoptional
|
String The last name of the customer.
|
Kumar |
surlmandatory
|
String The success URL, which is the page PayU will redirect to if the transaction is successful.
|
https://test-payment-middleware.payu.in/simulatorResponse |
furlmandatory
|
String The failure URL, which is the page PayU will redirect to if the transaction fails.
|
https://test-payment-middleware.payu.in/simulatorResponse |
hashmandatory
|
String It is the hash calculated by the merchant. The hash calculation logic is:sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT) Reference: For detailed information on hashing, refer to Generate Hash. |
|
address1optional
|
String The first line of the billing address.Fraud Detection: This information is helpful for fraud detection and chargebacks. Please provide the correct information. |
H.No- 17, Block C, Kalyan Bldg, Khardilkar Road, Mumbai |
address2optional
|
String The second line of the billing address.
|
34 Saikripa-Estate, Tilak Nagar |
cityoptional
|
String The city where your customer resides as part of the billing address.
|
Mumbai |
stateoptional
|
String The state where your customer resides as part of the billing address.
|
Maharashtra |
countryoptional
|
String The country where your customer resides.
|
India |
zipcodeoptional
|
String Billing address zip code is mandatory for the cardless EMI option.Character Limit: 20 |
400004 |
enforced_paymentoptional
|
String This parameter is to customize the payment options for each transaction. You can enforce specific payment modes, card schemes, and specific banks under Net Banking using this method.
|
creditcard|debitcard |
drop_categoryoptional
|
String This parameter is used if you want to hide one or multiple payment options. For example, if you consider the payment options such as credit card, debit card, and net banking, you can hide the credit card mode of payment.
|
CC |
udf1optional
|
String User-defined fields (udf) are used to store any information corresponding to a particular transaction. You can use up to five udfs in the post designated as udf1, udf2, udf3, udf4, udf5.
|
AELPR****E |
udf2optional
|
String User-defined fields (udf) are used to store any information corresponding to a particular transaction. You can use up to five udfs in the post designated as udf1, udf2, udf3, udf4, udf5.
|
|
udf3optional
|
String User-defined fields (udf) are used to store any information corresponding to a particular transaction.
|
02-02-1980 |
udf4optional
|
String User-defined fields (udf) are used to store any information corresponding to a particular transaction.
|
XYZ Pvt. Ltd. |
udf5optional
|
String User-defined fields (udf) are used to store any information corresponding to a particular transaction.
|
098450845 |
custom_noteoptional
|
String This parameter allows you to display a message on the PayU Payment page. This can be useful if you want to provide additional information to your customers, such as an extra charge for a particular product. The message specified in the custom_note parameter will be displayed below the payment options.
|
You will be charged an extra amount of Rs 100 on this transaction |
note_categoryoptional
|
String This parameter allows you to specify which payment options the custom_note message will be displayed for. This parameter should contain a comma-separated list of the payment options that you want the custom_note displayed for. Example: "CC, NB" will show the custom_note for Credit Card & Net banking only.
|
CC, NB |
Step 2. Hash the request and post to PayU
You must hash the request parameters using the following hash logic:
sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT)
For more information, refer to Generate Hash.
Sample request
PayU Hosted Checkout cURL Request Walkthrough Open Recipe | _payment Request Python Code Walkthrough Open Recipe |
_payment Request Java Code Walkthrough Open Recipe | _payment Request PHP Code Walkthrough Open Recipe |
curl -X POST "https://test.payu.in/_payment" \
-H "accept: application/json" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "key=JP***g" \
-d "txnid=PQI6MqpYrjEefU" \
-d "amount=10.00" \
-d "firstname=PayU User" \
-d "[email protected]" \
-d "phone=9876543210" \
-d "productinfo=iPhone" \
-d "surl=https://apiplayground-response.herokuapp.com/" \
-d "furl=https://apiplayground-response.herokuapp.com" \
-d "hash=05a397501918ec5c36ae52daa3b3e49b43e986b86940e109d060076e467c3ea7536617df7420e0e6863dced8c5b45f9fff15c13bdf0335512c05f0210b31b072"
import requests
url = "https://test.payu.in/_payment"
payload = "key=JP***g&txnid=Dnh8wYimuCRIdv&amount=10.00&firstname=PayU User&[email protected]&phone=9876543210&productinfo=iPhone&pg=&bankcode=&surl=https://apiplayground-response.herokuapp.com/&furl=https://apiplayground-response.herokuapp.com/&hash=cb4b8bda5677dbe80f53735b1d0ec5d48164c3654627369268cf6bf266db994db39108ce2e0868c953e66c172f6b2d78836b253d3463d0cc40d9b6a93118ed56"
headers = { "Accept": "application/json", "Content-Type": "application/x-www-form-urlencoded" }
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
<?php
$url = "https://test.payu.in/_payment";
$req = req_init($url);
req_setopt($req, CURLOPT_URL, $url);
req_setopt($req, CURLOPT_POST, true);
req_setopt($req, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"Content-Type: application/x-www-form-urlencoded",
);
req_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$data = "key=JP***g&txnid=Dnh8wYimuCRIdv&amount=10.00&firstname=PayU User&[email protected]&phone=9876543210&productinfo=iPhone&pg=&bankcode=&surl=https://apiplayground-response.herokuapp.com/&furl=https://apiplayground-response.herokuapp.com/&ccnum=&ccexpmon=&ccexpyr=&ccvv=&ccname=&txn_s2s_flow=&hash=cb4b8bda5677dbe80f53735b1d0ec5d48164c3654627369268cf6bf266db994db39108ce2e0868c953e66c172f6b2d78836b253d3463d0cc40d9b6a93118ed56";
req_setopt($curl, CURLOPT_POSTFIELDS, $data);
$resp = req_exec($req);
req_close($req);
var_dump($resp);
?>
import org.apache.http.HttpResponse;
import org.apache.http.client.fluent.Request;
import org.apache.http.entity.ContentType;
import org.apache.http.util.EntityUtils;
public class Main {
public static void main(String[] args) throws Exception {
Request request = Request.Post("https://test.payu.in/_payment -H");
String body = "key=JP***g&txnid=Dnh8wYimuCRIdv&amount=10.00&firstname=PayU User&[email protected]&phone=9876543210&productinfo=iPhone&pg=&bankcode=&surl=https://apiplayground-response.herokuapp.com/&furl=https://apiplayground-response.herokuapp.com/&ccnum=&ccexpmon=&ccexpyr=&ccvv=&ccname=&txn_s2s_flow=&hash=cb4b8bda5677dbe80f53735b1d0ec5d48164c3654627369268cf6bf266db994db39108ce2e0868c953e66c172f6b2d78836b253d3463d0cc40d9b6a93118ed56";
request.bodyString(body, ContentType.APPLICATION_FORM_URLENCODED);
request.setHeader("Content-Type", "application/x-www-form-urlencoded");
HttpResponse httpResponse = request.execute().returnResponse();
System.out.println(httpResponse.getStatusLine());
if (httpResponse.getEntity() != null) {
String html = EntityUtils.toString(httpResponse.getEntity());
System.out.println(html);
}
}
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace PayUExample
{
class Program
{
static async Task Main(string[] args)
{
// Set the API endpoint URL
string apiUrl = "https://test.payu.in/_payment";
// Create an HttpClient instance
using (HttpClient client = new HttpClient())
{
// Set request headers
client.DefaultRequestHeaders.Add("accept", "application/json");
client.DefaultRequestHeaders.Add("Content-Type", "application/x-www-form-urlencoded");
// Set request parameters
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("key", "JP***g"),
new KeyValuePair<string, string>("txnid", "PQI6MqpYrjEefU"),
new KeyValuePair<string, string>("amount", "10.00"),
new KeyValuePair<string, string>("firstname", "PayU User"),
new KeyValuePair<string, string>("email", "[email protected]"),
new KeyValuePair<string, string>("phone", "9876543210"),
new KeyValuePair<string, string>("productinfo", "iPhone"),
new KeyValuePair<string, string>("surl", "https://apiplayground-response.herokuapp.com/"),
new KeyValuePair<string, string>("furl", "https://apiplayground-response.herokuapp.com"),
new KeyValuePair<string, string>("hash", "05a397501918ec5c36ae52daa3b3e49b43e986b86940e109d060076e467c3ea7536617df7420e0e6863dced8c5b45f9fff15c13bdf0335512c05f0210b31b072")
});
// Send the POST request
HttpResponseMessage response = await client.PostAsync(apiUrl, content);
// Read the response content
string responseContent = await response.Content.ReadAsStringAsync();
// Print the response
Console.WriteLine(responseContent);
}
}
}
}
Step 3: Check the response from PayU
Sample response
The response URL returned from PayU is similar to the following:
mihpayid=403993715523615328&mode=CC&status=success&unmappedstatus=captured&key=JPM7Fg&txnid=50QJq6lBJBmx14&amount=10.00&cardCategory=domestic&discount=0.00&net_amount_debit=10&addedon=2021-07-28+15%3A11%3A37&productinfo=iPhone&firstname=PayU+User&lastname=&address1=&address2=&city=&state=&country=&zipcode=&email=test%40gmail.com&phone=9876543210&udf1=&udf2=&udf3=&udf4=&udf5=&udf6=&udf7=&udf8=&udf9=&udf10=&hash=afeab9dcf4e43d47f8fbf5a6838d393c70694a58e30ada08e6cb86ac943236c05717c5f5e4872d671fe81d0d9b2d9facd44e9a061ba621aff6f20c4343ea5dfa&field1=&field2=&field3=&field4=&field5=&field6=&field7=&field8=&field9=Transaction+Completed+Successfully&payment_source=payu&PG_TYPE=CC-PG&bank_ref_num=7f0d5ada-59bb-41d7-9e41-20a6af2406c9&bankcode=CC&error=E000&error_Message=No+Error&name_on_card=test&cardnum=411111XXXXXX1111&cardhash=This+field+is+no+longer+supported+in+postback+params.
/**
* PayU Payment Response Handling with Fetch API
* This code processes the PayU response data and sends it to your server
*/
// PayU response data from the callback
const payuResponseData = "mihpayid=403993715523615328&mode=CC&status=success&unmappedstatus=captured&key=JPM7Fg&txnid=50QJq6lBJBmx14&amount=10.00&cardCategory=domestic&discount=0.00&net_amount_debit=10&addedon=2021-07-28+15%3A11%3A37&productinfo=iPhone&firstname=PayU+User&lastname=&address1=&address2=&city=&state=&country=&zipcode=&email=test%40gmail.com&phone=9876543210&udf1=&udf2=&udf3=&udf4=&udf5=&udf6=&udf7=&udf8=&udf9=&udf10=&hash=afeab9dcf4e43d47f8fbf5a6838d393c70694a58e30ada08e6cb86ac943236c05717c5f5e4872d671fe81d0d9b2d9facd44e9a061ba621aff6f20c4343ea5dfa&field1=&field2=&field3=&field4=&field5=&field6=&field7=&field8=&field9=Transaction+Completed+Successfully&payment_source=payu&PG_TYPE=CC-PG&bank_ref_num=7f0d5ada-59bb-41d7-9e41-20a6af2406c9&bankcode=CC&error=E000&error_Message=No+Error&name_on_card=test&cardnum=411111XXXXXX1111&cardhash=This+field+is+no+longer+supported+in+postback+params";
// Parse the response data into an object
function parsePayUResponse(responseString) {
const payuData = {};
const pairs = responseString.split('&');
for (const pair of pairs) {
const [key, value] = pair.split('=');
if (key && value !== undefined) {
payuData[decodeURIComponent(key)] = decodeURIComponent(value);
}
}
return payuData;
}
// Parse the response
const parsedResponse = parsePayUResponse(payuResponseData);
// URL of your server endpoint that will process the payment result
const serverUrl = 'https://your-server.com/api/payment-result';
// Send the parsed response to your server using Fetch API
fetch(serverUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
payuResponse: parsedResponse,
// You can add additional client-side information here if needed
clientInfo: {
browserInfo: navigator.userAgent,
timestamp: new Date().toISOString()
}
})
})
.then(response => {
if (!response.ok) {
throw new Error(`Server responded with status: ${response.status}`);
}
return response.json();
})
.then(data => {
console.log('Payment verification successful:', data);
// Handle successful verification (e.g., show success message, redirect to order confirmation)
if (parsedResponse.status === 'success') {
// Redirect to success page or show success message
// window.location.href = '/payment-success?txnid=' + parsedResponse.txnid;
}
})
.catch(error => {
console.error('Payment verification error:', error);
// Handle error (e.g., show error message)
});
import requestsurl = "https://test.payu.in/_payment"payload = "key=JP***g&txnid=Dnh8wYimuCRIdv&amount=10.00&firstname=PayU User&[email protected]&phone=9876543210&productinfo=iPhone&pg=&bankcode=&surl=https://apiplayground-response.herokuapp.com/&furl=https://apiplayground-response.herokuapp.com/&hash=cb4b8bda5677dbe80f53735b1d0ec5d48164c3654627369268cf6bf266db994db39108ce2e0868c953e66c172f6b2d78836b253d3463d0cc40d9b6a93118ed56"headers = { "Accept": "application/json", "Content-Type": "application/x-www-form-urlencoded" }response = requests.request("POST", url, data=payload, headers=headers, params=querystring)print(response.text)
$url = "https://test.payu.in/_payment";$req = req_init($url);req_setopt($req, CURLOPT_URL, $url);req_setopt($req, CURLOPT_POST, true); req_setopt($req, CURLOPT_RETURNTRANSFER, true);$headers = array( "Content-Type: application/x-www-form-urlencoded", ); req_setopt($curl, CURLOPT_HTTPHEADER, $headers);$data = "key=JP***g&txnid=Dnh8wYimuCRIdv&amount=10.00&firstname=PayU User&[email protected]&phone=9876543210&productinfo=iPhone&pg=&bankcode=&surl=https://apiplayground-response.herokuapp.com/&furl=https://apiplayground-response.herokuapp.com/&ccnum=&ccexpmon=&ccexpyr=&ccvv=&ccname=&txn_s2s_flow=&hash=cb4b8bda5677dbe80f53735b1d0ec5d48164c3654627369268cf6bf266db994db39108ce2e0868c953e66c172f6b2d78836b253d3463d0cc40d9b6a93118ed56"req_setopt($curl, CURLOPT_POSTFIELDS, $data);$resp = req_exec($req);req_close($req);var_dump($resp);
Request request = Request.Post("https://test.payu.in/_payment -H");String body = "key=JP***g&txnid=Dnh8wYimuCRIdv&amount=10.00&firstname=PayU User&[email protected]&phone=9876543210&productinfo=iPhone&pg=&bankcode=&surl=https://apiplayground-response.herokuapp.com/&furl=https://apiplayground-response.herokuapp.com/&ccnum=&ccexpmon=&ccexpyr=&ccvv=&ccname=&txn_s2s_flow=&hash=cb4b8bda5677dbe80f53735b1d0ec5d48164c3654627369268cf6bf266db994db39108ce2e0868c953e66c172f6b2d78836b253d3463d0cc40d9b6a93118ed56"request.bodyString(body,ContentType.APPLICATION_FORM_URLENCODED);request.setHeader("Content-Type", "application/x-www-form-urlencoded");HttpResponse httpResponse = request.execute().returnResponse();System.out.println(httpResponse.getStatusLine());if (httpResponse.getEntity() != null) {String html = EntityUtils.toString(httpResponse.getEntity());System.out.println(html);}
The response mentioned earlier looks like the following when parsed:
mihpayid: 403993715523615328
mode: CC
status: success
unmappedstatus: captured
key: JPM7Fg
txnid: 50QJq6lBJBmx14
amount: 10.00
cardCategory: domestic
discount: 0.00
net_amount_debit: 10
addedon: 2021-07-28 15:11:37
productinfo: iPhone
firstname: PayU User
lastname:
address1:
address2:
city:
state:
country:
zipcode:
email: [email protected]
phone: 9876543210
udf1:
udf2:
udf3:
udf4:
udf5:
udf6:
udf7:
udf8:
udf9:
udf10:
hash: afeab9dcf4e43d47f8fbf5a6838d393c70694a58e30ada08e6cb86ac943236c05717c5f5e4872d671fe81d0d9b2d9facd44e9a061ba621aff6f20c4343ea5dfa
field1:
field2:
field3:
field4:
field5:
field6:
field7:
field8:
field9: Transaction Completed Successfully
payment_source: payu
PG_TYPE: CC-PG
bank_ref_num: 7f0d5ada-59bb-41d7-9e41-20a6af2406c9
bankcode: CC
error: E000
error_message: No Error
name_on_card: test
cardnum: 411111XXXXXX1111
cardhash: This field is no longer supported in postback params.
Integration security
After receiving a response from PayU, you must calculate the hash again and validate it against the hash that you sent in the request to ensure the transaction is secure. PayU recommends implementing the transaction details APIs and webhook/callback as an extra security measure. For more information on this process, refer to Get Transaction Details API APIs and Webhooks documentation.
You need to ensure that sensitive information related to the integration is not part of the payment request to PayU. The details including — but are not limited to — the following are considered sensitive information:
- salt value
- plain text hash string
Along with the request, the sensitive information should not be a part of any merchant-level URL. The following are considered sources for the merchant-level URL:
- The last web address accessed by a browser before loading PayU’s checkout page.
- URLs shared as part of payment request to PayU in the parameters: surl, furl, curl, nurl, and termUrl.
- Notification URLs configured with the merchant account.
- Invoice Completion URLs configured with the merchant account.
Important: Compare the parameters sent by PayU in the response with the ones you sent in the request to make sure none of them have been changed. You should verify specific parameters such as the transaction ID and amount. PayU is not responsible for any security breaches or loss resulting from your failure to implement the necessary security measures.
Step 4: Verify the payment
PayU recommends this step to reconcile with PayU’s database after you receive the response. Verify the transaction details using the Verification APIs.
Tip: The Transaction ID (txnid) value that you passed in request of Step 1 with PayU must be used here.
Environment
Test Environment | https://test.payu.in/merchant/postservice.php?form=2 |
Production Environment | https://info.payu.in/merchant/postservice.php?form=2 |
Sample request
curl --location 'https://test.payu.in/merchant/postservice.php?form=2' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'key=JP***g' \
--data-urlencode 'command=verify_payment' \
--data-urlencode 'var1=IhfgcZnXR4o4nB' \
--data-urlencode 'hash=a0ae79fdd66c875af6e9b21c4a67f1822deb00f2df5e9f0b1948f3222f536a9bf741b24efbb1874ca0f84f76b036e6c0d641581d0100f7abe4aeed2f3264f5c9'
Sample response
- If credit card payment is made, the response is similar to the following:
{
"status": 1,
"msg": "1 out of 1 Transactions Fetched Successfully",
"transaction_details": {
"1733900931584": {
"mihpayid": "21820644083",
"request_id": null,
"bank_ref_num": null,
"amt": "1.00",
"transaction_amount": "1.00",
"txnid": "1733900931584",
"additional_charges": "0.00",
"productinfo": "Macbook Pro",
"firstname": "Abc",
"bankcode": "MAST",
"udf1": "udf1",
"udf2": "udf2",
"udf3": "udf3",
"udf4": "udf4",
"udf5": "udf5",
"field2": null,
"field9": "OTP/ATM page expired due to no user action",
"error_code": "E1602",
"addedon": "2024-12-11 12:43:03",
"payment_source": "payu",
"card_type": "MAST",
"error_Message": "Bank was unable to authenticate.",
"net_amount_debit": "0.00",
"disc": "0.00",
"mode": "DC",
"PG_TYPE": "DC-PG",
"card_no": "XXXXXXXXXXXX7596",
"status": "failure",
"unmappedstatus": "dropped",
"Merchant_UTR": null,
"Settled_At": null,
"cardhash": "095d184331be367bb92aa3eeecb57d0728de96cc598dd563d407982d75021149",
"name_on_card": null,
"card_token": "4e97156bc2d6320cdfe15",
"field4": null,
"threeDSVersion": "2.2.0",
"offerAvailed": null
}
}
}
- Offer availed on cart level
{
"status": 1,
"msg": "1 out of 1 Transactions Fetched Successfully",
"transaction_details": {
"1036-f0cf85f2": {
"mihpayid": "21564143078",
"request_id": "",
"bank_ref_num": "431998369241",
"amt": "2.00",
"transaction_amount": "2.00",
"txnid": "1036-f0cf85f2",
"additional_charges": "0.00",
"productinfo": "EXPRESS",
"firstname": "guest",
"bankcode": "TEZOMNI",
"udf1": "Magento2",
"udf2": "",
"udf3": "",
"udf4": "",
"udf5": "qs8rbc1ng2hmqtakk381en6j2p",
"field2": "114390824407",
"field9": "SUCCESS|Completed Using Callback",
"error_code": "E000",
"addedon": "2024-11-14 16:06:40",
"payment_source": "express",
"card_type": null,
"error_Message": "NO ERROR",
"net_amount_debit": 2.00,
"disc": "0.00",
"mode": "UPI",
"PG_TYPE": "UPI-PG",
"card_no": "",
"status": "success",
"unmappedstatus": "captured",
"Merchant_UTR": null,
"Settled_At": "0000-00-00 00:00:00",
"App_Name": "GooglePay",
"card_token": null,
"field4": null,
"offerAvailed": null,
"cart_details": {
"id": "2446425",
"payu_id": "21564143078",
"total_items": "1",
"total_cart_amount": "2.00",
"offer_applied": null,
"offer_availed": null,
"offer_auto_apply": "0",
"instant_discount": "0.00",
"cashback_discount": "0.00",
"total_discount": "0.00",
"net_cart_amount": "2.00",
"created_at": "2024-11-14 16:06:40",
"updated_at": "2024-11-14 16:06:40",
"sku_details": [
{
"id": "3468748",
"cart_id": "2446425",
"payu_id": "21564143078",
"mid": "2",
"sku_id": "Sample Sofa Design-Red",
"sku_name": "Sample Sofa Designtest?=!name",
"amount_per_sku": "2.00",
"quantity": "1",
"amount_before_discount": "2.00",
"discount": "0.00",
"amount_after_discount": "2.00",
"offer_applied": null,
"offer_availed": null,
"offer_status": null,
"offer_type": null,
"offer_auto_apply": "0",
"is_nce": "0",
"failure_reason": null,
"created_at": "2024-11-14 16:06:40",
"updated_at": "2024-11-14 16:06:40",
"offer_title": null,
"offer_description": null,
"instant_discount": null,
"cashback_discount": null,
"offers_raw_response": null,
"raw_response": null
}
]
}
}
}
}
- Offer availed at Transaction level
{
"status": 1,
"msg": "1 out of 1 Transactions Fetched Successfully",
"transaction_details": {
"1725950872187": {
"mihpayid": "20911942990",
"request_id": null,
"bank_ref_num": null,
"amt": "9900.00",
"transaction_amount": "10000.00",
"txnid": "1725950872187",
"additional_charges": "0.00",
"productinfo": "Macbook Pro",
"firstname": "Abc",
"bankcode": "MAST",
"udf1": "udf1",
"udf2": "udf2",
"udf3": "udf3",
"udf4": "udf4",
"udf5": "udf5",
"field2": null,
"field9": "You have reached credit card load limit. Please use other payment options to continue.",
"error_code": "E4936",
"addedon": "2024-09-10 12:18:20",
"payment_source": "payu",
"card_type": "MAST",
"error_Message": "Bank was unable to authenticate.",
"net_amount_debit": "0.00",
"disc": "100.00",
"mode": "DC",
"PG_TYPE": "DC-PG",
"card_no": "XXXXXXXXXXXX9528",
"status": "failure",
"unmappedstatus": "failed",
"Merchant_UTR": null,
"Settled_At": null,
"cardhash": "31056eb2112b68cdc90896f1953ca26605bb525249096172c178881bcd45ac93",
"name_on_card": null,
"card_token": null,
"field4": null,
"offerApplied": "LoadTest1@m3phN7YptAA6",
"offerAvailed": "LoadTest1@m3phN7YptAA6",
"transactionOffer": "{"offer_data":[{"offer_key":"LoadTest1@m3phN7YptAA6","discount":100,"offer_type":"INSTANT","isNoCost":false,"flag_to_fail":false,"status":"SUCCESS","failure_code":null,"failure_reason":"Offer Applied Successfully","offer_description":"Load Test 1","offer_title":"Load Test 1","record_type":"OFFER","parent_offer_key":null,"offer_category":null,"isDpEmi":false}],"discount_data":{"total_discount":100,"cashback_discount":0,"instant_discount":100,"total_nce_discount":0,"instant_nce_discount":0,"cashback_nce_discount":0,"gstSubventedViaOffer":false,"downPaymentAmount":0}}",
"offerType": "instant",
"offerLevel": "TRANSACTION_LEVEL"
}
}
}
Failure Responses
- If txnID is not found, the response is similar to the following:
{
"status":0,"msg":"0 out of 1 Transactions Fetched
Successfully","transaction_details":{"IhfgcZnXR4o4nB":{"mihpayid":"Not Found","status":"Not Found"}}
}
Response parameters
Parameter | Description | Example |
---|---|---|
status | This parameter returns the status of web service call. The status can be any of the following:
| 0 |
msg | This parameter returns the reason string. | For example, any of the following messages are displayed:
|
transaction_details | This parameter contains the response in a JSON format. For more information refer to JSON fields description for transaction_details parameter . | |
request_id | PayU Request ID for a request in a Transaction. For example, a transaction can have a refund request. | 7800456 |
bank_ref_num | This parameter returns the bank reference number. If the bank provides after a successful action. | 204519474956 |
To learn more about the possible error codes and their description, refer to Error Codes.
Updated 2 days ago