Classic Integration-S2S

Collect Payment API with PayU Hosted Checkout integration

You can collect card payments using Server-to-Server integration. This section provides the request and response parameters used in Step 1 of Classic Integration for Cards. You can get the sample request and response when use the "Try It" experience. For the complete integration steps, refer to Classic Integration for Cards.

👍

Experience the end-to-end Merchant Hosted Checkout > Cards flow and instantly generate the complete code for seamless, zero-coding integration into your website.


Postman Collection

Accelerate your integration workflow with our Postman collection for PayU Hosted Checkout. Click the Download Postman Collection button below to download and get started.



📘

Reference: For the character limit of each parameter and detailed description, refer to Additional Info for Payment APIs.

Collect info for Fraud Detection & Chargeback Prevention

Collecting the information for the following parameters from customers is helpful when it comes to issues related to fraud detection and chargebacks. Hence, it is must to provide the correct information:

  • email
  • phone
  • address1
  • s2s_client_ip
  • s2s_device_info

Environment

Sample request
curl --location --request POST 'https://secure.payu.in/_payment' --header 'Content-Type: application/x-www-form-urlencoded' --header 'Cookie: PHPSESSID=mj185cifujktpv1igu9tmuoaal; PAYUID=eac5648ac59712238883a78e71f35717; PHPSESSID=638b1b5173542' --data-urlencode 'hash=d89e7d88863617baf01e504c50aa58e94d6ff3371c2ed409ca1f139cfee75d67e85ce7e91c4224790b6cc1b59bb149fc98b0272e27b335225a9d288a34290e42' --data-urlencode 'key=s*****s' --data-urlencode 'txnid=payuTestTransaction3818940' --data-urlencode 'amount=1.0' --data-urlencode 'firstname=Ashish' --data-urlencode '[email protected]' --data-urlencode 'phone=9988776655' --data-urlencode 'productinfo=Product Info' --data-urlencode 'surl=https://admin.payu.in/test_response' --data-urlencode 'furl=https://admin.payu.in/test_response' --data-urlencode 'notifyurl=https://admin.payu.in/test_response' --data-urlencode 'codurl=https://admin.payu.in/test_response' --data-urlencode 'ipurl=https://admin.payu.in/test_response' --data-urlencode 'lastname=' --data-urlencode 'udf1=' --data-urlencode 'udf2=' --data-urlencode 'udf3=' --data-urlencode 'udf4=' --data-urlencode 'udf5=' --data-urlencode 'pg=CC' --data-urlencode 'bankcode=DC' --data-urlencode 'ccnum=XXXXXXXXXXX8811' --data-urlencode 'ccname=Ashish' --data-urlencode 'ccvv=XXX' --data-urlencode 'ccexpmon=12' --data-urlencode 'ccexpyr=2023' --data-urlencode 'txn_s2s_flow=4' --data-urlencode 'authentication_flow=REDIRECT' 
Sample response
{
   "metaData":{
      "message":null,
      "referenceId":"a74a67e965537b0f817e925e45321194",
      "statusCode":null,
      "txnId":"payuTestTransaction3818940",
      "txnStatus":"Enrolled",
      "unmappedStatus":"pending"
   },
   "result":{
      "otpPostUrl":"",
      "acsTemplate":"PGh0bWw+PGJvZHk+PGZvcm0gbmFtZT0icGF5bWVudF9wb3N0IiBpZD0icGF5bWVudF9wb3N0IiBhY3Rpb249Imh0dHBzOi8vYWNzLmZzc25ldC5jby5pbi9hY3NhdXRoc2VydmVyL1VCSS9WL3BhcmVxLmh0bSIgbWV0aG9kPSJwb3N0Ij48aW5wdXQgdHlwZT0iaGlkZGVuIiBuYW1lPSJQYVJlcSIgdmFsdWU9ImVKeFVVdUZ1c2pBVWZSWGpBOUNXaWdaemJjTEViR1JEaVp2NWZuZHdveVFDV3NwRW4zNnRnTzRqSWJubjlIQTRQUzE4SFJSaStJbHBvMUJBakhVdDl6aktzOFdZY3NyWnpQVTVHd3RJZ2kyZUJmeWdxdk9xRk15aGpndGtnT1k3bFI1a3FRWEk5UHdTcmNXRVRiazdCZEpES0ZCRm9lQitzcVBkWTh3NWtJNkdVaFlvRW5uZGpWNGJ0WmRWQ2VST1FWbzFwVlpYd1Qzak5RQm8xRkVjdEQ3TkNibGNMbzdHV2hkOUFDZXRDZ0xFK29BOFV5V05uV3JqMk9hWmlKYkIvdkdHd1MwTzQzWjlpN3o0dGxvQXNRcklwRWJoVXRkbEx1VWo2czhuc3ptblFPNDh5TUpHRWR2YVlRNHpiSS9oWkg4VGRJRFpoYjhFbUlvVmx1bXdtd0VCdHFlcVJLTXdqVDVtSU0vTXl6ZmJhNnBOVlZQNTdudmZiWVBOZXZZdnE0cGp2ZHA4S085cnRiSFJlNUYxekUxUkxtZWRwUVZBckEzcEQ5SjBjejlwTS8xM0EzNEJBQUQvL3dYQWdRQUFBQUFBa1A5ckFHTkhyZkk9Ij48aW5wdXQgdHlwZT0iaGlkZGVuIiBuYW1lPSJUZXJtVXJsIiB2YWx1ZT0iaHR0cHM6Ly9zZWN1cmUucGF5dS5pbi83OGIxN2YyZWJkYmUyNjgwNjMzNDY3NzA0MjAzMzgyYS9Db21tb25QZ1Jlc3BvbnNlSGFuZGxlci5waHAiPjxpbnB1dCB0eXBlPSJoaWRkZW4iIG5hbWU9Ik1EIiB2YWx1ZT0iMDMwMzE3MzA1NSI+PC9mb3JtPjxzY3JpcHQgdHlwZT0ndGV4dC9qYXZhc2NyaXB0Jz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5vbmxvYWQ9ZnVuY3Rpb24oKXsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5mb3Jtc1sncGF5bWVudF9wb3N0J10uc3VibWl0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIDwvc2NyaXB0PjwvYm9keT48L2h0bWw+"
   },
   "binData":{
      "pureS2SSupported":false,
      "issuingBank":"UBI",
      "category":"debitcard",
      "cardType":"VISA",
      "isDomestic":true
   }
}
Response parameters
ParameterDescription
metaDataJSON It is a JSON object containing more information about the response.
metaData.referenceIdString This is the PayU reference ID which we will be sending to merchant so that they can send us this back in second call.
binDataJSON This is a JSON object containing information about card number or token number.
binData.pureS2SSupportedBoolean The value for this parameter will be returned false for REDIRECT.
resultJSON This is a JSON object containing response of the request and to be used in subsequent steps.
result.otpPostUrlString The parameter will have null value in case of REDIRECT.
result.acsTemplateString acsTemplate is a base64 encoded string. The merchant needs to decode acsTemplate, which is an HTML format with auto submit, which then needs to be shown on the customer's browser. The HTML being auto submit, it will take the customer to the bank page for authentication.

For the response parameters, refer to Additional Info for Payment APIs.

Request parameters

🚧

Error Handling:

A list of error message with corresponding error code and reason for the error is listed in . PayU recommends you to handle these errors when you process the transactions. For more information, refer to Error Codes

Values to be used in Test environment

For values to be used in Test environment, refer to Test Cards.

Form Data
string
required
Defaults to JPM7Fg

This parameter must contain the merchant key provided by PayU.

integer
required

The transaction ID is a reference number for a specific order that is generated by the merchant. It is used to track the order and must be unique. PayU's system will not accept duplicate transaction IDs.

number
required

This field should contain the payment amount for the transaction.

string
required

This field should be a string containing a brief description of the product.

string
required

The first name of the customer.

string
required

The email address of the customer.

integer
required

The phone number of the customer.

string
required

The "surl" field is the success URL, which is the page PayU will redirect to if the transaction is successful. The merchant can handle the response at this URL after the customer is redirected there.

string
required

The "furl" field is the Failure URL, which is the page PayU will redirect to if the transaction is failed. The merchant can handle the response at this URL after the customer is redirected there.

string
required

It is used to avoid the possibility of transaction tampering. Hash formula: sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|||||||SALT)

const
enum
required

The pg parameter determines which payment tabs will be displayed on the PayU page. For example, if 'pg' = 'NB', the Net Banking tab will be displayed. If no value is specified for this parameter 'CC' will be takes as default value

Allowed:
const
enum
required

Each payment option is identified with a unique bank code at PayU. The merchant must post this parameter with the corresponding payment option’s bank code value in it.

Allowed:
const
enum
required

This parameter must be passed with the value as 4 for Cards Decoupled flow.

Allowed:
string

Use 13-19 digit card number for credit/debit cards (15 digits for AMEX, 13-19 for Maestro) and validate with LUHN algorithm. Use only test cards as in the example or that is listed in Test Cards, UPI ID and Wallets section..

string

Use 3-digit CVV number for credit/debit cards and 4-digit security code (4DBC/CID) for AMEX cards. Validate with BIN API.

string

String This parameter must contain the name on card – as entered by the customer for the transaction.

string

This parameter must contain the card’s expiry month – as entered by the user for the transaction. It must always be in 2 digits or in MM format. For months 1-9, this parameter must be appended with 0 – like 01, 02…09. For months 10-12, this parameter must not be appended – It should be 10,11 and 12 respectively.

string

This parameter must contain the card’s expiry year – as entered by the customer for the transaction. It must be of four digits. Use 2025 in this field for Test environment.

string

Last name of the customer (must only contains alphabets).

string

The "curl" field is the Cancel URL, which is the page PayU will redirect to if the transaction is canceled by the customer. The merchant can handle the response at this URL after the customer is redirected there.

string
Defaults to 0

This parameter is used to identify whether it is a B2B transaction. If 1 is posted, it is a B2B transaction.

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.

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.

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.

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.

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.

string
Defaults to REDIRECT

This parameter must be passed with value as REDIRECT.

string

This parameter must have the customer agent’s device.

string

This parameter must have the user agent of device.

Response
200
Language
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here!