UPI Intent S2S Integration

The following steps allow you to integrate the server-to-server UPI intent:

  1. Initiate payment
  2. Invoke UPI Intent on customer’s device
  3. Check UPI transaction status
  4. PayU sends Server-to-Server callback response

👍

Before you begin:

Register for a account with PayU before you start integration. For more information, refer to Register for a Merchant Account.

Intent Flow Diagram

The following diagram depicts the UPI intent flow from server to server:


Step 1: Initiate payment

Environment

The _payment API needs to be called with all the required parameters. For the complete list of parameters, refer to UPI Collection - S2S.

This needs to be a server-to-server cURL request. This API is used for both Cards and UPI for generating a new transaction.

If specific intent has to be opened instead of Generic Intent, then the bankcode values will change accordingly:

  • For Generic Intent, bankcode = INTENT

📘

Notes:

  • If you are using this for their application, then the Generic Intent, and Specific Intent, can be invoked.
  • If you are using this for your Mobile Web, then only Generic Intent can be invoked. To invoke App specific intents on the mobile web, the libraries have to be added separately. PayU offers the same for GPay Intent through the Mobile web. Refer to the GPay Seamless Integration Document for the same.
  • User VPA is not required for this flow.

Request parameters

For the complete list of parameters, refer to UPI Collection - S2S.

ParameterDescriptionExample
key
mandatory
String The merchant key provided by PayU must be included.
Reference: For more information on how to generate the Key and Salt, refer to any of the following:

- Production: Access Production Key and Salt
- Test: Access Test Merchant Key and Salt
txnid
mandatory
String (alphanumeric) Merchant transaction identifier - This parameter must be unique (after a successful transaction) & alphanumeric special (<= 50 characters & excluding >,<, =,:,&, ‘).1234_abcdedf
amount
mandatory
String (rounded to two decimal places) This parameter must contain the amount for which QR needs to be generated. The amount should be greater than or equal to Rs.1.00.1000
phone
mandatory
String This parameter must contain the customer phone number (10 characters).9876786756
productinfo
mandatory
String (alphanumeric) This field must contain the product name. By default, the value is 'storefront' (max. 100 characters).iPhone 12
firstname
mandatory
String This parameter must contain the customer's first name (max. 60 characters).Sundar
email
mandatory
String This parameter must contain the customer email ID.[email protected]
pg
mandatory
String It must be set as UPI for this transaction.UPI
bankcode
mandatory
String It must be set as INTENT for this transaction.INTENT
lastname
optional
String This parameter must contain the customer last name (maximum 20 characters).Teja
address1
optional
String This parameter must contain the first line of customer address (up to 100 characters).PayU, Bestech Business Tower, Gurgaon
address2
optional
String This parameter must contain the second line of the customer address (up to 100 characters).Sohna Road
city
optional
String This parameter must contain the customer city (max. 50 characters).Gurgaon
country
optional
String This parameter must contain the customer's country that is part of the address (max. 50 characters).India
state
optional
String This parameter must contain the customer state that is part of the address (max 50 characters).Haryana
zipcode
optional
Numeric This parameter must contain the customer's PIN code (6 digits).122018
udf1
optional
String This parameter can include any custom information in request (up to 255 characters).Website order
udf2
optional
String This parameter can include any custom information in request (up to 255 characters.).
udf3
optional
String This parameter can include any custom information in request.
(up to 255 characters.)
udf4
optional
String This parameter can include any custom information in request.
(up to 255 characters.)
udf5
optional
String This parameter can include any custom information in request.
(up to 255 characters.)
txn_s2s_flow
mandatory
Numeric This parameter must be passed with the value as 44
s2s_client_ip
mandatory
varchar This parameter must have the source IP of the user's device.
Note: This information is helpful when it comes to issues related to fraud detection and chargebacks. Hence, it is must to provide the correct information.
s2s_device_info
mandatory
varchar This parameter must have the user agent of device.
Note: This information is helpful when it comes to issues related to fraud detection and chargebacks. Hence, it is must to provide the correct information.
upiAppName
mandatory
For Specific Intent, merchant should share the app name which is selected by customer on the merchant check-out page. The following are the enum’s expected for major apps:

- phonepe
- googlepay
- paytm
- bhim
- cred
- amazonpay
- whatsapp
- genericintent – For any other app apart from
above
phonepe
hash
mandatory
String Hash is a crucial parameter – used specifically to avoid any tampering during the transaction. For more information, refer to Generate Hash.

📘

Support queries:

For any issues or queries related to UPI integration, send an email to [email protected].

Response for S2S request

Collect the response in the UPI Collection - S2S. under API Reference. The response for the S2S payment request is not similar to Merchant Hosted or PayU Hosted Checkout. For description of response parameters, refer to Additional Info for Payment APIs.

Using the IntentURIData value in response

The IntentURIData parameter returns the URI in the response. For example, it contains the first debit amount .

📘

Notes:

  • Every time there is a change, you need to incorporate the changes to avoid breaking the transactions.
  • The tid value which is passed in the intent URI acts as a validation check at NPCI’s end which do not allow duplicate transaction.
  • The tr value not necessary and it is a payU_id. It can be any reference id for PayU’s internal reconciliation.

Step 2: Invoke UPI Intent on customer’s device

You need to invoke intent in the customer’s mobile device using the merchant VPA URL. Make sure that only this merchant VPA is embedded in the intent call since this helps to track the status of the transaction.

Open the UPI Intent as per the NPCI Guidelines. Merchants can also open any specific app instead of making the Generic Intent call. For example, Google Pay, PhonePe, etc. This URL can then be fired using an Intent or a hyperlink which would open an Intent tray with a list of available supporting apps on the user’s mobile device. The following sample UPI Deep Link URL and the format used for creating the URL:

Sample URL (with values from the above sample JSON):

upi://pay?pa=payu@axisbank&pn=SMSPLUS&tr=8312916361&am=10.17

Format for UPI Deep Linking URL (as per NPCI guidelines):

"upi://pay?pa=" + merchantVpa + "&pn=" + merchantName + "&tr=" + referenceId + "&am=" + amount 

Where the description of the parameters used in the URL is as described in the following table:

ParameterDescription
merchantVpaAs received in JSON response in key merchantVPA’
merchantNameAs received in JSON response in key merchantName.
referenceIdAs received in JSON response in key referenceId.
amountAmount of transaction. This must be the same as the amount passed to the initiatePayment API.

Step 3: Check UPI transaction status

Check the UPI transaction status using the Verify Payment API (verify_payment) API. For more information, refer to Verify Payment API.


Step 4: PayU sends Server-to-Server callback response

PayU can also send a server-to-server callback response whenever the transaction status gets updated.

Implementation

The server-to-server response would be sent by PayU on a pre-set URL, which has to be provided by you. PayU will configure it at your back end. This response would be sent in key/value pair separated by the ampersand (&) character. In case any parameter is not used, we would send it back to you with an empty string. The sample response is similar to the following:

unmappedstatus=success&phone=9999999999&txnid=FCDA1R100870163781&hash=84e3 35094bbcb2ddaa0f9a488eb338e143b273765d89c9dfa502402562d0b6f3c7935e28194ca92f7 380be7c84c3695415b106dcf52cb016a15fcf6adc98d724&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=SUCC ESS&email=NA&mihpayid=175477248&surl=https://www.ABC.in/payment/handlepayuresp osne&card_hash=9e88cb0573d4a826b61d808c0a870ed4a990682459b0ec9e95ea421e8e47b e8c&field1=42812

The parameter list format is similar to the following:

mihpayid,mode,status,key,txnid,amount,productinfo,firstname,lastname,address1,address2,city,state,country,zipcode,email,phone,udf1,udf2,udf3,udf4,udf5,udf6,udf7,udf8,udf9,udf10,card_token,card_no,field0,field1,field2,field3,field4,field5,field6,field7,field8,field9,offer,discou nt,offer_availed,unmappedstatus,hash,bank_ref_no,surl,curl,furl,card_hash