Verify Payment API

To know the status of the payment, you need to integrate the** Verify Payment** API as below. You need post the txnId sent by the v2/payments API in the txnId parameter.

HTTP Method: POST

Environment

Request parameters

Request header

ParameterDescription
dateThe current date and time. For example, format of the date is Wed, 28 Jun 2023 11:25:19 GMT.
authorizationThe 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

FieldDescription
usernameRepresents the username or identifier for the client or merchant, for example smsplus.
algorithmUse SHA512 algorithm for hashing and send this as header value.
headersSpecifies which headers have been used in generating the hash, for example date.
signatureThe 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:

Hash logic: sha512(<Body data> + '|' + date + '|' + merchant_secret)

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}"`;
}

Body parameters

Parameter Description Example

txnId
mandatory

You need post the txnId sent by the v2/payments API. For more information, refer to any of the following:

54dzPX68BZzE46Q2VYWw

Sample request

curl --location 'https://test.payu.in/v3/transaction' \
--header 'Content-Type: application/json' \
--header 'date: Thu, 27 Mar 2025 06:35:21 GMT' \
--header 'authorization: hmac username="PRiQvJ", algorithm="sha512", headers="date", signature="42a54cc7450fe1e7a3cf35ebfaed1b828e37062964266fd33186c7b2526e85e3ea2d46946a728ca50e46423ea9a6b2edb8c1315b58fa69297e1e91d3d34804a1"' \
--header 'Info-Command: verify_payment' \
--data '{
    "txnId":["512345678901234"]
}'

Response parameters

The fields in the result parameter JSON are described in the following table:

FieldDescriptionExample
mihpayIdTransaction ID is a unique number assigned by PayU for each transaction. Keep note of it for future reference for inquiry or refund.21612493009
bankReferenceNumberFor each successful transaction – this parameter would contain the bank reference number generated by the bank.2411194544
amountThis parameter would contain the actual amount involved in the transaction.0.00
modeThis parameter describes the payment mode by which the transaction was completed (e.g., CC for Credit Card).CC
requestIdA unique identifier for the request.
originalAmountThe original transaction amount before applying charges or discounts.100.00
additionalChargesAdditional charges, if any, applied to the transaction amount.0.00
discountAny discount amount applied to the transaction.0.00
netDebitAmountTotal amount debited from the payer's account after additional charges and discounts.100.00
productInfoA brief description of the product or service for which the payment was being made.cred_product
firstNameThe payer’s first name involved in the transaction.CRED
bankcodeThe code of the bank used for the transaction.AMEX
nameOnCardCardholder's name (null if the value is not captured).(null)
cardNoMasked card number for enhanced security.XXXXXXXXXXXX2001
cardTypeThe type of card used, such as AMEX for American Express.AMEX
udf1 to udf5User-defined fields for additional optional data during the transaction process.(null)
field2Context-specific information from the bank, such as codes or values relevant to verification.140455
field9Describes the status of the transaction.Transaction is Successful
errorCodeThis parameter provides error code information.E000
errorMessageProvides a human-readable error message for failed transactions.No Error
addedOnTimestamp when the transaction was initiated.2024-11-19 21:17:55
settledAtTimestamp when funds were settled.0000-00-00 00:00:00
paymentSourceThe source of payment handling.payuS2S
pgTypeIndicates the type of payment gateway used.CC-PG
statusDisplays the overall status of the transaction.success
unmappedStatusInternal transaction status in PayU’s system, mapped separately.captured
merchantUTRMerchant's Unique Transaction Reference.(null)
messageGeneral status message for the transaction.Found TxnId
txnIdThe transaction ID provided by the merchant for tracking purposes.54dzPX68BZzE46Q2VYWw
rupayAuthRefNoReference ID specific to RuPay Cards.AAACAVJIggICQyRYdUiCEAAAAAA=
authRefNoA bank-specific authorization reference number.AAACAVJIggICQyRYdUiCEAAAAAA=
originalCurrencyThe currency used for the transaction.INR
threeDSVersionVersion of the 3D Secure protocol used for securing the transaction.2.2.0

Sample response

Success scenario

Formatted JSON Response:

If successfully fetched:

{
    "message": "Success",
    "status": 1,
    "result": [
        {
            "mihpayId": 21612493009,
            "bankReferenceNumber": "2411194544",
            "amount": 0.00,
            "mode": "CC",
            "requestId": "",
            "originalAmount": 100.00,
            "additionalCharges": 0.00,
            "discount": 0.00,
            "netDebitAmount": 100.00,
            "productInfo": "cred_product",
            "firstName": "CRED",
            "bankcode": "AMEX",
            "nameOnCard": null,
            "cardNo": "XXXXXXXXXXXX2001",
            "cardType": "AMEX",
            "udf1": null,
            "udf2": null,
            "udf3": null,
            "udf4": null,
            "udf5": null,
            "field2": "140455",
            "field9": "Transaction is Successful",
            "errorCode": "E000",
            "errorMessage": "No Error",
            "addedOn": "2024-11-19 21:17:55",
            "settledAt": "0000-00-00 00:00:00",
            "paymentSource": "payuS2S",
            "pgType": "CC-PG",
            "status": "success",
            "unmappedStatus": "captured",
            "merchantUTR": null,
            "mcpLookupId": null,
            "mcpAmount": null,
            "mcpCurrency": null,
            "mcpExchangeRate": null,
            "rupayAuthRefNo": "AAACAVJIggICQyRYdUiCEAAAAAA=",
            "authRefNo": "AAACAVJIggICQyRYdUiCEAAAAAA=",
            "originalCurrency": "INR",
            "threeDSVersion": "2.2.0",
            "merNetAmount": null,
            "offerAvailed": null,
            "message": "Found TxnId",
            "txnId": "54dzPX68BZzE46Q2VYWw"
        }
    ]
}

Failure scenarios

  • Transaction not found
{
    "message": "Success",
    "status": 1,
    "result": [
        {
            "message": "not found",
            "txnId": "Test1235677235455"
        }
    ]
}