Cards Classic Integration - v2 Payment API

You can collect card payments using classic seamless integration. For seamless Classic integration, the additionalInfo.txnS2sFlow field is set to 4.

The Classic Seamless Integration supports both physical card details and saved card tokens, providing a complete server-to-server payment solution with 3DS authentication redirection.

Environment

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

Request body

Parameter Description Example

accountId
mandatory

String The merchant key provided by PayU during onboarding.

UMXDPA

txnId
mandatory

String Transaction ID provided by the merchant and this must be unique for every transaction.

ZP6267f0d2996ce

paymentMethod
mandatory

Object Details about the payment method used. For Classic Integration:
• name: "CreditCard" or "DebitCard"
• bankCode: Card type code
• paymentCard: Card details object

{"name": "CreditCard", "bankCode": "CC"}

order
mandatory

Object Details about the transaction order including product information, ordered items, user-defined fields, and payment charge specifications. For more information, refer to order object fields description.

additionalInfo
mandatory

Object Additional information including S2S flow configuration and authentication settings. For more information, refer to additionalInfo object fields description.

callBackActions
mandatory

Object Actions to perform on the payment server in different scenarios. For more information, refer to callBackActions object fields description.

billingDetails
mandatory

Object Billing details of the customer including name, address, phone number, email, etc. For more information, refer to billingDetails object fields description.

paymentMethod object fields description

Field Description Example

name
mandatory

String This field must contain the payment mode code. For Classic Integration, use "CreditCard" or "DebitCard". For more information, refer to Payment Mode Codes.

CreditCard

bankCode
mandatory

String This field must contain the card type code. For more information, refer to Card Type Codes and Supported Banks for Cards.

CC

paymentCard
mandatory for cards

Object This object contains the physical card or saved card token details. For more information, refer to paymentCard object fields description.

paymentCard object fields description

Parameter Description Example
cardNumber
mandatory for physical card
Card number. 5497774415170603
validThrough
mandatory for physical card
Expiry date in MM/YYYY format. 05/2025
ownerName
optional
Name of the card owner. Ashish
cvv
mandatory for physical card
CVV number of the card. 123
tavv
mandatory for saved card
Cryptogram of the card for tokenized payments. AAABAWFlmQAAAABjRWWZEEFgFz
last4Digits
mandatory for saved card
Last four digits of the card. 0603
cardTokenType
mandatory for saved card
Card token type. Valid values: PAYU, NETWORK, ISSUER. PAYU
cardToken
mandatory for saved card
Card token of the stored card. b5f2d8785768087678fm9

order object fields description

Parameter Description Example
productInfo
mandatory
Product details. Product details
orderedItem
optional
Details about the items ordered. Array of Objects
userDefinedFields
optional
Custom fields for additional information. Fields: udf1, udf2, udf3, udf4, udf5, udf6, udf7, udf8, udf9, udf10. For more information, refer to Object
paymentChargeSpecification
mandatory
Includes amount and charges. For more information, refer to paymentChargeSpecification object fields description Object
paymentChargeSpecification object fields description
Parameter Description Example
price
mandatory
The transaction amount. 1000
netAmountDebit
optional
Net amount to be debited. 1000
taxSpecification
optional
Tax details of the product/order. Object
convenienceFee
optional
Fees format (e.g., CC:12). CC:12
offers
optional
Offers applied or available for the payment. Object
userDefinedFields object fields description
FieldDescription
udf1User defined field.
udf2User defined field.
udf3User defined field.
udf4User defined field.
udf5User defined field.
udf6User defined field.
udf7User defined field.
udf8User defined field.
udf9User defined field.
udf10User defined field.

additionalInfo object fields description

Parameter Description Example
enforcePaymethod
optional
Force a transaction with a specified method (e.g., CC, DC). CC
forcePgid
optional
Forces identification for payment gateway. PG123
partnerHoldTime
optional
Time held by the partner for the transaction. 60
userCredentials
optional
Credentials for user authentication. string
userToken
optional
Token for the customer. user_token_123
subventionAmount
optional
Amount paid through EMI subvention payments. 100
authOnly
optional
Initiates an authentication-only payment (true/false). false
createOrder
optional
A flag to store the order details (true/false). true
txnS2sFlow
optional
For defining seamless/non-seamless flows in handling payments. seamless
Field Description Example

txnS2sFlow
mandatory for S2S

String Indicates the transaction S2S flow type and must be set to "4" for Classic Integration.

4

authenticationFlow
mandatory for S2S

String Indicates the authentication flow type and must be set to "REDIRECT" for Classic Integration.

REDIRECT

createOrder
optional

Boolean Whether to create an order during the payment process.

false

preAuthorize
optional

String Set to "1" for authorization-only transactions.

1

callBackActions object fields description

Parameter Description Example
successAction
mandatory
URL to be called on payment success. https://example.com/success
failureAction
mandatory
URL to be called on payment failure. https://example.com/failure
cancelAction
mandatory
URL to be called if user cancels the payment. https://example.com/cancel
codAction
optional
URL for Cash on Delivery (COD) action. https://example.com/cod

billingDetails object fields description

Parameter Description Example
firstName
mandatory
First name of the billing contact. Ashish
lastName
optional
Last name of the billing contact. Kumar
address1
mandatory
Primary billing address. 123 Main Street
address2
optional
Secondary billing address. Apt 4B
phone
optional
Phone number of the billing contact. 9123456789
email
mandatory
Email address of the billing contact. [email protected]
city
optional
City of the billing address. Bharatpur
state
optional
State of the billing address. Rajasthan
country
optional
Country of the billing address. India
zipCode
optional
Postal/Zip code of the billing address. 321028

Sample request

curl --location 'https://apitest.payu.in/v2/payments' \
--header 'date: Thu, 27 Mar 2025 10:12:27 GMT' \
--header 'authorization: hmac username="UMXDPA", algorithm="sha512", headers="date", signature="ec84843a663143bb89391f6fa2d4b9404bab1543a3eee81263b4a507ebf5d289d8fad1fbcdd59da820951e3e0f9b0b0b3d1bad9b41338804e7c42a8a6197c6e9"' \
--header 'Content-Type: application/json' \
--data-raw '{
    "accountId": "UMXDPA",
    "txnId": "ZP6267f0d2996ce",
    "amount": 10,
    "paymentMethod": {
        "name": "CreditCard",
        "bankCode": "CC",
        "paymentCard": {
            "cardNumber": "5004461234560000",
            "validThrough": "04/2025",
            "ownerName": "John Doe",
            "cvv": "987"
        }
    },
    "order": {
        "productInfo": "Classic Integration Payment",
        "orderedItem": [
            {
                "itemId": "1",
                "description": "Product Description",
                "quantity": 1,
                "amount": 10.0
            }
        ],
        "userDefinedFields": {
            "udf1": "",
            "udf2": "",
            "udf3": "",
            "udf4": "",
            "udf5": "",
            "udf6": "",
            "udf7": "",
            "udf8": "",
            "udf9": "",
            "udf10": ""
        },
        "paymentChargeSpecification": {
            "price": 10,
            "netAmountDebit": 10,
            "convenienceFee": "CC:12,AMEX:19,SBIB:98,DINR:2,DC:25,NB:55"
        }
    },
    "additionalInfo": {
        "txnS2sFlow": "4",
        "authenticationFlow": "REDIRECT",
        "createOrder": false,
        "preAuthorize": "1"
    },
    "callBackActions": {
        "successAction": "https://yoursite.com/success",
        "failureAction": "https://yoursite.com/failure"
    },
    "billingDetails": {
        "firstName": "John",
        "lastName": "Doe",
        "address1": "123 Main Street",
        "city": "Mumbai",
        "state": "Maharashtra",
        "country": "India",
        "zipCode": "400001",
        "phone": "9876543210",
        "email": "[email protected]"
    }
}'

Sample response

{
    "result": {
        "redirectUrl": "https://secure.payu.in/ResponseHandler.php",
        "paymentId": "21667772394",
        "card": {
            "binData": {
                "pureS2SSupported": false,
                "issuingBank": "ICICI",
                "category": "creditcard",
                "cardType": "MAST",
                "isDomestic": true
            }
        }
    },
    "status": "PENDING"
}

Response parameters

Parameter Description Example

redirectUrl

URL to which the user is redirected after the payment process is completed.

https://secure.payu.in/ResponseHandler.php

paymentId

Unique identifier for the payment transaction.

21667772394

card.binData.issuingBank

Name of the bank that issued the card.

ICICI

card.binData.category

Category of the card (creditcard, debitcard).

creditcard

card.binData.cardType

Type of the card (MAST for Mastercard, VISA, etc.).

MAST

card.binData.isDomestic

Boolean indicating if the card is domestic.

true

status

Status of the payment transaction.

PENDING

📘

Reference:

To check the transaction status, refer to Verify Payment API. The Verify Payment API is mandatory for Classic Integration to obtain the final transaction status.