UPI Intent S2S Integration
The following steps allow you to integrate the server-to-server UPI intent:
- Initiate payment
- Invoke UPI Intent on customer’s device
- Check UPI transaction status
- 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.
Parameter | Description | Example |
---|---|---|
keymandatory | 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 | |
txnidmandatory | String (alphanumeric) Merchant transaction identifier - This parameter must be unique (after a successful transaction) & alphanumeric special (<= 50 characters & excluding >,<, =,:,&, ‘). | 1234_abcdedf |
amountmandatory | 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 |
phonemandatory | String This parameter must contain the customer phone number (10 characters). | 9876786756 |
productinfomandatory | String (alphanumeric) This field must contain the product name. By default, the value is 'storefront' (max. 100 characters). | iPhone 12 |
firstnamemandatory | String This parameter must contain the customer's first name (max. 60 characters). | Sundar |
emailmandatory | String This parameter must contain the customer email ID. | [email protected] |
pgmandatory | String It must be set as UPI for this transaction. | UPI |
bankcodemandatory | String It must be set as INTENT for this transaction. | INTENT |
lastnameoptional | String This parameter must contain the customer last name (maximum 20 characters). | Teja |
address1optional | String This parameter must contain the first line of customer address (up to 100 characters). | PayU, Bestech Business Tower, Gurgaon |
address2optional | String This parameter must contain the second line of the customer address (up to 100 characters). | Sohna Road |
cityoptional | String This parameter must contain the customer city (max. 50 characters). | Gurgaon |
countryoptional | String This parameter must contain the customer's country that is part of the address (max. 50 characters). | India |
stateoptional | String This parameter must contain the customer state that is part of the address (max 50 characters). | Haryana |
zipcodeoptional | Numeric This parameter must contain the customer's PIN code (6 digits). | 122018 |
udf1optional | String This parameter can include any custom information in request (up to 255 characters). | Website order |
udf2optional | String This parameter can include any custom information in request (up to 255 characters.). | |
udf3optional | 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.) | |
udf5optional | String This parameter can include any custom information in request.(up to 255 characters.) | |
txn_s2s_flowmandatory | Numeric This parameter must be passed with the value as 4 | 4 |
s2s_client_ipmandatory | 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_infomandatory | 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. | |
upiAppNamemandatory | 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 - genericintent – For any other app apart from above | phonepe |
hashmandatory | 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].
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](ref: addl_info-payment-apis#response-for-initial-server-to-server-request).
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:
Parameter | Description |
---|---|
merchantVpa | As received in JSON response in key merchantVPA’ |
merchantName | As received in JSON response in key merchantName. |
referenceId | As received in JSON response in key referenceId. |
amount | Amount 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
Updated about 2 months ago