UPI Consent Transaction

This section provides the request parameters, sample request and response for a UPI Recurring Payment consent transaction.

📘

Note:

  • During integration with PayU, first integrate with the Test Server environment. PayU will provide you the necessary Merchant Key for the test serve. After testing is done, you are ready to move to the Production server.
  • Unlike Cards

HTTP Method: POST

Environment

Request parameters

In the merchant-initiated POST REQUEST, Hash is a mandatory parameter. It is critical to calculate the hash correctly and post it to PayU in the request.

ParameterDescriptionValue
key
mandatory
String The merchant key is a unique identifier for a merchant account in PayU's database.Your Test Key
api_version
optional
String The API version for this API.7
txnid
mandatory
String 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.s7hhDQVWvbhBdN
amount
mandatory
String This field should contain the payment amount for the transaction.10.00
productinfo
mandatory
String It should be a string containing a brief description of the product.Character Limit-100iPhone
firstname
mandatory
String The first name of the customer.Character Limit-60Ashish
email
mandatory
String The email of the customer.Character Limit-50[email protected]
phone
mandatory
String The phone number of the customer.9876543210
lastname
mandatory
String The last name of the customer.Character Limit-60Verma
address1
optional
String The first line of the billing address.Character Limit-100H.No- 17, Block C, Kalyan Bldg, Khardilkar Road, Mumbai
address2
optional
String The second line of the billing address.Character Limit-10034 Saikripa-Estate, Tilak Nagar
city
optional
String The city where your customer resides as part of the billing address.Mumbai
state
optional
String The state where your customer resides as part of the billing address,Maharashtra
country
optional
String The country where your customer resides.Character Limit-50India
zipcode
optional
String Billing address zip code is mandatory for the cardless EMI option.Character Limit-20400004
surl*
mandatory
String 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.https://apiplayground-response.herokuapp.com/
furl
mandatory
String 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.https://apiplayground-response.herokuapp.com/
hash
mandatory
String It is used to avoid the possibility of transaction tampering. For more information on hash generation process, refer to Generate Hasheabec285da28fd
0e3054d41a4d24fe
9f7599c9d0b6664
6f7a9984303fd612
4044b6206daf831
e9a8bda28a6200d
318293a13d6c193
109b60bd4b4f8b09
c90972
pg
mandatory
varchar The pg parameter for UPI must be UPI.UPI
bankcode
mandatory
varchar This parameter contains UPI or INTENT for UPI.UPI
si
mandatory
This parameter signifies a successful consent taken from the user by the merchant. This parameter must contain 1 for a successful consent. Without this parameter sent as 1, subscription cannot be set up.
Notes: You can modify or cancel existing recurring payment registration as described in the following sections:
. Manage Recurring Payment for Cards
. Manage UPI Recurring Transaction
si_details
mandatory
This parameter represents mandatory details which need to be passed to during registration transaction from merchant system to PayU.

Note: It is mandatory as per the latest RBI guidelines to pass this information to the payment processor so that same can be forwarded to acquirers and issuers ( for more details refer – https://www.rbi.org.in/Scripts/NotificationUser.aspx?Id=11668&Mode=0 )

This is a JSON object and it includes a set of fields. For more information, refer to SI Parameter JSON Details
vpa
mandatory for UPI Collect
varchar This parameter contains the customer’s VPA handle. For the list UPI handles supported, refer to UPI Handles

The merchant is advised to check the validity of the VPA through using the VPA Validation API. PayU extends support for the same if required. For more information on using VPA Validation API, refer to Validate VPA Handle API.
abc@upi
txn_s2s_flow
mandatory for UPI Intent
integer This parameter must be passed with the values as 4 for UPI Intent.4

📘

Notes

The bankcode parameter value can be any of the following:

  • UPI: Pass this value for UPI transactions.
  • INTENT: Pass this value for Intent.

For more information on bank codes used for recurring payments registration, refer to Bank Codes - Recurring Payments

Characters allowed for parameters

For parameters address1, address2, city, state, country, product info, email, and phone following characters are allowed:

  • Characters: A to Z, a to z, 0 to 9
  • – (Minus)
  • _ (Underscore)
  • @ ()
  • / (Slash)
  • (Space)
  • . (Dot)

Sample request

The sample code block for UPI Seamless integration (Merchant-Hosted Checkout) is similar to the following code block:

📘

Note:

Before you make payment request to PayU, it is recommended to validate the UPI handle provided by your customer is eligible for recurring payment using the validateVPA API to avoid transaction failure. For more information, refer to Validate UPI Handle.

UPI Consent Transaction

curl -X \
 POST "https://test.payu.in/_payment-H "accept: application/json" -H \
 "Content-Type: application/x-www-form-urlencoded" -d”key=Q*****U&txnid=4eZz2lMbUYQ4c0&amount=10.00&firstname=Payu-Admin&[email protected]&phone=1234567890&productinfo=iPhone&api_version=7&si=1&pg=UPI&bankcode=UPI&vpa=anything@payu&surl=https://test.payu.in/admin/test_response
/&furl=https://test.payu.in/admin/test_response&si_details={“billingAmount”: “10.00”,”billingCurrency”: “INR”,”billingCycle”: “MONTHLY”,”billingInterval”: 1,”paymentStartDate”: “2019-09-01″,”paymentEndDate”: “2019-12-01”}
&hash=e36568b2dfc460eab0eb3387fb7d90543ed861154f273b9593d6fcc152ed93a91e529c2f4be0965eeb57104e82d58889fa5efb52811ec78cbd1ad646e39c29a0”

UPI Intent

curl -X \
 POST "https://test.payu.in/_payment-H "accept: application/json" -H \
 "Content-Type: application/x-www-form-urlencoded" -d”key=Q*****U&txnid=4eZz2lMbUYQ4c0&amount=10.00&firstname=Payu-Admin&[email protected]&phone=1234567890&productinfo=iPhone&api_version=7&si=1&pg=UPI&bankcode=INTENT&txn_s2s_flow=4&surl=https://test.payu.in/admin/test_response
/&furl=https://test.payu.in/admin/test_response&si_details={“billingAmount”: “10.00”,”billingCurrency”: “INR”,”billingCycle”: “MONTHLY”,”billingInterval”: 1,”paymentStartDate”: “2019-09-01″,”paymentEndDate”: “2019-12-01”}
&hash=e36568b2dfc460eab0eb3387fb7d90543ed861154f273b9593d6fcc152ed93a91e529c2f4be0965eeb57104e82d58889fa5efb52811ec78cbd1ad646e39c29a0”

Understanding Response

For also UPI registration transaction, you must ensure that the payment response from PayU has the expected values as described in the following table so that the UPI registration is successful or initiated successfully with the customer’s bank or UPI provider.

Response ParameterExpected ValueDescription
statussuccessIndicates that the transaction is successful with the UPI provider
payment_sourceSISTIndicates that UPI details have been marked correctly for Standing Instruction
mihpayid<mihpayid number> sent. by PayUIndicates PayU’s transaction acknowledgment for a Consent transaction

The response URL returned from PayU is in the form URL format (application/x-www-form-urlencoded).

Sample response

  • The formatted response for UPI Consent Transaction is similar to the following:
Array
(
    [mihpayid] => 403993715525317379
    [mode] => UPI
    [status] => success
    [unmappedstatus] => captured
    [key] => JPM7Fg
    [txnid] => 4eZz2lMbUYQ4c0
    [amount] => 10.00
    [discount] => 0.00
    [net_amount_debit] => 10
    [addedon] => 2022-02-02 16:00:53
    [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] => 1b1df6deb730c4826341e35b9b010497f524c88e3cee05287f0148dd302f81ab45503a27f43d492d127134cf5983eab1042930f10a04f27a094e19c500644104
    [field1] => anything@payu
    [field2] => 4eZz2lMbUYQ4c0
    [field3] => 
    [field4] => PayU User
    [field5] => AXIDI0zH6YxpU1eCukPM4fBdnxkf54cEKbt
    [field6] => 
    [field7] => Transaction completed successfully
    [field8] => 
    [field9] => Transaction completed successfully
    [payment_source] => sist
    [PG_TYPE] => UPI-PG
    [bank_ref_num] => 4eZz2lMbUYQ4c0
    [bankcode] => UPI
    [error] => E000
    [error_Message] => No Error
)
  • The formatted response for UPI Intent:
{
   "metaData":{
      "message":null,
      "referenceId":"5ae6e6d94b4b5f9dee282b95f6020c98",
      "statusCode":null,
      "txnId":"40d553e62525a03e5c54",
      "txnStatus":"pending",
      "unmappedStatus":"pending"
   },
   "result":{
      "paymentId":"15257049438",
      "merchantName":"smsplus",
      "merchantVpa":"growfitter.payu@hdfcbank",
      "amount":"1.90",
      "intentURIData":"upi:\/\/mandate?pa=growfitter.payu@hdfcbank&pn=IBIBO GROUP PRIVATE LIMITED&mn=&tid=40d553e62525a03e5c54&validitystart=30052022&validityend=01092022&am=10.00&amrule=MAX&recur=MONTHLY&recurvalue=30&recurtype=&tr=15257049438&cu=INR&mc=5411&tn=UPI Transaction for 40d553e62525a03e5c54&mode=13&purpose=14&orgid=159240&rev=Y&block=N&txnType=CREATE",
      "postToBank":{
         "token":"C6ABAA6A-F0CE-432A-61C1-CFA48EDE847B",
         "amount":"1.90",
         "mihpayid":"5ae6e6d94b4b5f9dee282b95f6020c98",
         "disableIntentSeamlessFailure":"0",
         "payeeVpa":"growfitter.payu@hdfcbank",
         "payeeName":"smsplus",
         "additionalCharges":0,
         "transactionFee":"1.90"
      },
      "issuerUrl":"https:\/\/secure.payu.in\/591d096c5495eff4234e95eb64a1e1b8\/intentSeamlessHandler.php"
   }
}

Webhook for Getting Transaction Details

You can expose a webhook by requesting the PayU Integration team to configure the same against the ws_online_response parameter. If this webhook is configured, you will receive the above response object over HTTP form post method similar to the following:

unmappedstatus=success&phone=9999999999&txnid=FCDA1R100870163781&hash=84e335094bbcb2ddaa0f9a488eb338e143b273765d89c9dfa502402562d0b6f3c7935e28194ca92f380be7c84c3695415b106dcf52cb016a15fcf6adc98d724&status=success&curl=https://www.abc.in/payment/handlepayuresposne&firstname=NA&card_no=519619XXXXXX5049&furl=https://www.abc.in/payment/handlepayuresposne&productinfo=2&mode=DC&amount=800.00&field4=6807112311042810&field3=6807112311042810&field2=838264&field9=SUCCESS&email=NA&mihpayid=175477248&surl=https://www.ABC.in/payment/handlepayuresposne&card_hash=9e88cb0573d4a826b61d808c0a870ed4a990682459b0ec9e95ea421e8e47be8c&field1=42812&payment_source=sist

If the mandate is not confirmed by the customer or the mandate is confirmed by the customer, but the mandate registration is rejected from the banks, the status is communicated as a “failure” over webhook. For more information, refer to Set up WebHook to Receive Cancellation or Modification Update from the Issuer Bank