The Get Transaction Details (get_Transaction_Details) API works based on input as two dates (initial and final), between which the transaction details are needed. The output consists of the status of the API (success or failure) and all the transaction details in an array format.
Postman Collection: Access the Get Transaction Details API Postman Collection from the following location:
Sample request
curl -X POST "https://test.payu.in/merchant/postservice?form=2" \
-H "accept: application/json" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "key=JP***g&command=get_Transaction_Details&var1=2020-10-20&var2=2020-10-27&hash=0545c11641bd91ed7ba2b5c937480b0f8737962ccc4959994f2aa950ca16212283e7c440a4251ffebd725e0c2c2c03701186eec82c8dd667e75dfbb3cba8e634"import requests
url = "https://test.payu.in/merchant/postservice?form=2"
headers = {
"accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded"
}
data = {
"key": "JP***g",
"command": "get_Transaction_Details",
"var1": "2020-10-20",
"var2": "2020-10-27",
"hash": "0545c11641bd91ed7ba2b5c937480b0f8737962ccc4959994f2aa950ca16212283e7c440a4251ffebd725e0c2c2c03701186eec82c8dd667e75dfbb3cba8e634"
}
response = requests.post(url, headers=headers, data=data)
print(response.json())const axios = require('axios');
const url = "https://test.payu.in/merchant/postservice?form=2";
const data = new URLSearchParams({
"key": "JP***g",
"command": "get_Transaction_Details",
"var1": "2020-10-20",
"var2": "2020-10-27",
"hash": "0545c11641bd91ed7ba2b5c937480b0f8737962ccc4959994f2aa950ca16212283e7c440a4251ffebd725e0c2c2c03701186eec82c8dd667e75dfbb3cba8e634"
});
axios.post(url, data, {
headers: {
"accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded"
}
})
.then(response => console.log(response.data));import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String url = "https://test.payu.in/merchant/postservice?form=2";
String formData = "key=JP***g&command=get_Transaction_Details&var1=2020-10-20&var2=2020-10-27&hash=0545c11641bd91ed7ba2b5c937480b0f8737962ccc4959994f2aa950ca16212283e7c440a4251ffebd725e0c2c2c03701186eec82c8dd667e75dfbb3cba8e634";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("accept", "application/json")
.header("Content-Type", "application/x-www-form-urlencoded")
.POST(HttpRequest.BodyPublishers.ofString(formData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());<?php
$url = "https://test.payu.in/merchant/postservice?form=2";
$data = array(
"key" => "JP***g",
"command" => "get_Transaction_Details",
"var1" => "2020-10-20",
"var2" => "2020-10-27",
"hash" => "0545c11641bd91ed7ba2b5c937480b0f8737962ccc4959994f2aa950ca16212283e7c440a4251ffebd725e0c2c2c03701186eec82c8dd667e75dfbb3cba8e634"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
));
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
?>Sample response
- Success scenario
{
"status": 1,
"msg": "Transaction Fetched Successfully",
"Transaction_details": [
{
"id": "403993715521889443",
"status": "captured",
"key": "JPM7Fg",
"merchantname": "demo",
"txnid": "02fdb4f0a0decd1e4937",
"firstname": "Ashish",
"lastname": "Kumar",
"addedon": "2020-10-26 13:54:52",
"bank_name": "Credit Card",
"payment_gateway": "AXISPG",
"phone": "9876543210",
"email": "[email protected]",
"transaction_fee": "10.00",
"amount": "10.00",
"discount": "0.00",
"additional_charges": "0.00",
"productinfo": "iPhone",
"error_code": "E000",
"bank_ref_no": "895255",
"ibibo_code": "CC",
"mode": "CC",
"ip": "106.202.49.52",
"card_no": "512345XXXXXX2346",
"cardtype": "domestic",
"offer_key": "",
"field2": "171519",
"udf1": "",
"pg_mid": null,
"offer_type": null,
"failure_reason": null,
"mer_service_fee": "0.00",
"mer_service_tax": "0.00"
},
{
"id": "403993715521889519",
"status": "failed",
"key": "JPM7Fg",
"merchantname": "demo",
"txnid": "4c5355da12224188d0ff",
"firstname": "K",
"lastname": "K",
"addedon": "2020-10-26 14:10:02",
"bank_name": "Credit Card",
"payment_gateway": "AXISPG",
"phone": "09599736876",
"email": "[email protected]",
"transaction_fee": "10.00",
"amount": "10.00",
"discount": "0.00",
"additional_charges": "0.00",
"productinfo": "i Phone",
"error_code": null,
"bank_ref_no": "372218",
"ibibo_code": "CC",
"mode": "CC",
"ip": "106.202.49.52",
"card_no": "512345XXXXXX2346",
"cardtype": "domestic",
"offer_key": "",
"field2": "603129",
"udf1": "",
"pg_mid": null,
"offer_type": null,
"failure_reason": null,
"mer_service_fee": null,
"mer_service_tax": null
},
{
"id": "403993715521891555",
"status": "captured",
"key": "JPM7Fg",
"merchantname": "demo",
"txnid": "e3bb0408ef94af722de5",
"firstname": "Ashish",
"lastname": "Kumar",
"addedon": "2020-10-26 20:59:41",
"bank_name": "Credit Card",
"payment_gateway": "AXISPG",
"phone": "0987654321",
"email": "[email protected]",
"transaction_fee": "10.00",
"amount": "10.00",
"discount": "0.00",
"additional_charges": "0.00",
"productinfo": "iPhone",
"error_code": "E000",
"bank_ref_no": "734154",
"ibibo_code": "CC",
"mode": "CC",
"ip": "106.202.39.89",
"card_no": "512345XXXXXX2346",
"cardtype": "domestic",
"offer_key": "",
"field2": "157887",
"udf1": "",
"pg_mid": null,
"offer_type": null,
"failure_reason": null,
"mer_service_fee": "0.00",
"mer_service_tax": "0.00"
}
]
}- Failure scenario
If transaction is not found, the response is similar to the following:
{
"status": 1,
"msg": "Transaction Fetched Successfully",
"Transaction_details": []
}If invalid date is posted, the response is similar to the following:
{
"status": 0,
"msg": "Invalid Date Entered. Date format should be yyyy-mm-dd"
}Response parameters
The transaction_details parameter of the response is in JSON format. The fields in this JSON are described in the following table:
JSON Parameter | Description | Example |
|---|---|---|
mihpayupid | This parameter contains a unique reference number created for each transaction at PayU’s end. You must note this transaction ID as this will be used as a reference for all the future actions on this transaction like Inquiry or Refund. | 403993715521937565 |
bank_ref_num | For each successful transaction – this parameter contains the bank reference number generated by the bank. | 527013524405 |
request_id | This parameter contains the request ID value posted by the merchant during the transaction request. | 131278422 |
amt | This parameter contains the original amount which was sent in the transaction request by the merchant. | 10.00 |
mode | This parameter contains the mode of the transaction such as credit card, debit card, etc. For more information, refer to Payment Mode Codes. | CC |
action | This parameter contains action taken on the transaction. The action can be any of the following:
| refund |
token | This parameter contains the Token ID (unique token from the merchant) for the refund request. | 20201105secrettokenatur |
status | This parameter contains the payment status. For more information, refer to Payment State Explanations. | Pending |
bank_arn | This parameter contains the Acquirer Reference Number (ARN) is a unique number is generated by the bank. This ARN is generated within 24-72 business hours of initiating the refund. | 74799877002005071918062 |
settlement_id | This parameter contains the settlement ID of the transaction. | 202110181245 |
amount_settled | This parameter contains the amount settled to the merchant. | 10.00 |
UTR_no | This parameter contains the merchant Unique Transaction Reference (UTR) number. | N223211598444659 |
value_date | This parameter contains the date when the refund took place or when the amount is reflected in merchant account in this parameter, where the date format is YYYY-MM-DD. | 2020-10-20 |
For more information on the possible error codes and their description, refer to Error Codes.
Request parameters
Reference information for request parameters
Parameter | Reference |
|---|---|
| key | For more information on how to generate the Key and Salt, refer to any of the following:
|
var3 | This parameter is used pagination to retrieve subsequent pages of results. |
| hash | Hash logic for this API is: |
Sample values
Use the following sample values while trying out the API:
var1: 2020-10-20var2: 2020-10-27
