In order to initiate payments for partners, Whatsapp needs to use the access token instead of key/salt.
The following steps allow you to integrate the server-to-server UPI intent:
- Initiate payment request
- Invoke UPI Intent on customer’s device
- Verify payment
- PayU sends Server-to-Server callback response
Step 1: Initiate payment request
Environment
UAT Host | <https://test-partnerapilayer.payu.in/apilayer> |
PROD Host | <https://api.payu.in> |
Request headers
Parameter | Value |
---|---|
Content-Type |
application/json |
Authorization |
Bearer |
Request parameters
The following table lists the request parameter descriptions for Partner Payment integration.
Extra params for Partner integration:
The following params are the extra parameters (optional) used compared to the regular _payment API, but with a different endpoint: partner_udf_3, partner_udf_4, shipping_firstname, shipping_lastname, shipping_address1, shipping_address2, shipping_city, shipping_state, shipping_country, shipping_zipcode, shipping_phone
Parameter | Description | Example |
---|---|---|
merchant_id mandatory |
|
8488225 |
txnid |
|
fd3e847h2 |
amount mandatory |
|
10 |
productinfo mandatory |
|
T-shirt |
firstname mandatory |
|
Ankit |
email |
|
|
phone mandatory |
|
|
txn_s2s_flow mandatory |
|
4 |
hash |
|
|
s2s_client_ip mandatory |
varchar This parameter must have the source IP of the user |
|
s2s_device_info mandatory |
varchar This parameter must have the user agent of the device |
|
reseller_id mandatory |
varchar This parameter is the unique Partner Identifier provided by PayU for your partner account. The Partner Identifier acts as the unique identifier to identify a particular Partner Account in our database. |
83fe-eb64-021844d8-9397-26535b1bf0c2 |
udf5 |
|
|
address1 optional |
|
|
address2 optional |
|
|
city |
|
|
state |
|
|
country |
|
|
zipcode |
|
|
partner_udf_3 |
This parameter has been made for partner to pass any information corresponding to the transaction. |
|
partner_udf_4 |
This parameter has been made for partner to pass any information corresponding to the transaction. |
|
shipping_firstname optional |
|
|
shipping_lastname optional |
|
|
shipping_address1 optional |
|
|
shipping_address2 optional |
|
|
shipping_city optional |
|
|
shipping_state optional |
|
|
shipping_country optional |
|
|
shipping_zipcode optional |
|
|
shipping_phone optional |
|
|
drop_category optional |
|
|
enforce_paymethod optional |
|
|
user_token optional |
|
|
offer_key optional |
|
|
offer_auto_apply |
|
|
additional_charges optional |
|
|
Sample request
curl --location --request POST 'https://test-partnerapilayer.payu.in/apilayer/partner/payments' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 9d2ab8e1b99aa02f6b827af5b5000b277d9cb1cd037acb7cb31436a5b0da4f74' \
--data-raw '{
"txnid": "nY3tkz3vciHFGTjblyFeycL2Zn1m",
"amount": 1090.33,
"productinfo": "whatsapp",
"firstname": "Manikanta",
"reseller_id": "83fe-eb64-021844d8-9397-26535b1bf0c2",
"merchant_id": 8238480,
"phone": 7036722360,
"hash": "5aadceaf6bec9158ccba8ec0dab32debcacbfd50e3587c077fa11107a5be0ac26712fae230522afb8908d068122c02f2d5c733a46c33ace0f66e5cc9d2ae4714",
"lastname": "CHeruku",
"email": "[email protected]",
"curl": "https://www.google.com",
"furl": "https://www.google.com",
"surl": "https://www.youtube.com",
"txn_s2s_flow": "4",
"s2s_device_info": "ewew",
"s2s_client_ip": "ewew"
}'
Sample response
{
"metaData": {
"message": null,
"referenceId": "024d9afbdbf85bd35b25649ccf983e16ee3d4646c2cdcffada88bd2df371fd43",
"statusCode": null,
"txnId": "nY3tkz3vciHFGTjblyFeycL2Zn1m",
"txnStatus": "pending",
"unmappedStatus": "pending"
},
"result": {
"paymentId": 403993715529028543,
"merchantName": "Merchant",
"merchantVpa": null,
"amount": "1090.33",
"intentURIData": "pa=&pn=&tr=403993715529028543&tid=PPPL403993715529028543290523133325&am=1090.33&cu=INR&tn=UPI Transaction for PPPL403993715529028543290523133325",
"acsTemplate": "PGh0bWw+PGJvZHk+PGZvcm0gbmFtZT0icGF5bWVudF9wb3N0IiBpZD0icGF5bWVudF9wb3N0IiBhY3Rpb249Imh0dHBzOi8vdGVzdC5wYXl1LmluLzAyNGQ5YWZiZGJmODViZDM1YjI1NjQ5Y2NmOTgzZTE2NGQ0YTUxYzYzNjcyODAxNjRkMDlkNDg2YjRkYWI1ZmEvaW50ZW50U2VhbWxlc3NIYW5kbGVyLnBocCIgbWV0aG9k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
}
}
Step 2: Invoke UPI Intent on Customer’s Device
Partner to open the UPI Intent as per the NPCI Guidelines. 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 in the user’s mobile device. Below is a sample UPI deep link URL and the format used for creating the URL:
Sample URL (with values from above sample JSON):
upi://pay?<IntentURIData>
Format for UPI Deep Linking URL (as per NPCI guidelines):
"upi://pay"+ <intentURIData>
After the response is received from the transacting app (BHIM/Google Pay/PhonePe/AxisPay/Any other app), a merchant can check the status of the transaction using the verify_payment API**.**
Failed responses
Code | Reason | Response |
---|---|---|
401 |
with invalid token |
{ |
403 |
with invalid hash |
{ |
400 |
without reseller_id |
{ |
400 |
without amount |
{ “amount is mandatory param” |
400 |
without merchant_id |
{ |
400 |
without hash |
{ |
400 |
without product_info |
{ |
Step 3: Verify Payment API
Check the UPI transaction status using the Verify Payment API (check_upi_txn_status) API.
After the response is received from your customer’s app (BHIM, Google Pay, PhonePe, AxisPay, or any other app), you can check the status of the transaction using the Verify Payment API. Web services can be accessed by making a server-to-server call using the following PayU URLs.
Environment
UAT Host | <https://test-partnerapilayer.payu.in/apilayer> |
PROD Host | <https://api.payu.in> |
Request headers
Parameter | Value |
---|---|
Content-Type | application/json |
Authorization | 039e0d1d70f467f946e2d73bd43868df856cfaa352ea54591a76bfc4a08d3487 |
Request parameters
Parameter | Description | Example |
---|---|---|
txnid |
In this parameter, you can include the txnid (Your transaction ID/order ID). |
100123 |
merchant_id |
It is the merchant id that PayU provided you. |
8238480 |
hash |
This parameter must contain the hash value to be calculated at your end. The string used for calculating the hash is mentioned below:
|
|
resseler_id |
varchar This parameter is the unique Partner Identifier provided by PayU for your partner account. The Partner Identifier acts as the unique identifier to identify a particular Partner Account in our database. |
83fe-eb64-021844d8-9397-26535b1bf0c3 |
Sample Request
curl --location --request POST 'https://test-partnerapilayer.payu.in/apilayer/partner/verifyPayment' \
--header 'Authorization: Bearer 9d2ab8e1b99aa02f6b827af5b5000b277d9cb1cd037acb7cb31436a5b0da4f74' \
--header 'Content-Type: application/json' \
--header 'Cookie: PHPSESSID=p576r3mrpdm29sersr0emhmc53' \
--data-raw '{
"txnid": "nY3tkz3vciHFGTjblyFeycL2Zn2c",
"merchant_id": "8238480",
"reseller_id": "83fe-eb64-021844d8-9397-26535b1bf0c2",
"hash": "0dd9057a6575f2f5531880b83f2f119356b9a841df18fc4487c1ab0fee8477d15d15cf43e37656b55a8bde0dbe048f0ef93b62420864ecbd7d7a5965300a4399"
}'
Response parameters
JSON Field | Description |
---|---|
mihpayid |
This field contains a unique reference number created for each transaction at PayU’s end. You must note this transaction ID as this will be used as a reference for all the future actions on this transaction like Inquiry or Refund. |
request_id |
This field would contain the request ID value posted by the merchant during the transaction request. |
bankrefnum |
For each successful transaction – this field would contain the bank reference number generated by the bank. |
amt |
This field contains the net amount debited from the customer’s account for this transaction. |
transaction_amount |
This field contains the original amount which was sent in the transaction request by the merchant |
productinfo |
This field contains the same value of product information which was sent in the transaction request from the merchant’s end to PayU. |
firstname |
This field contains the same value of first name which was sent in the transaction request from the merchant’s end to PayU. |
bankcode |
This field contains the code indicating the payment option used for the transaction. For example, in the Debit Card mode, there are different options like Visa Debit Card, Mastercard, Maestro etc. For each option, a unique bank code exists. It would be returned in this bank code parameter. For example, Visa Debit Card – VISA, Master Debit Card – MAST. |
udf1 |
This field contains the same value of udf values that were sent in the transaction request from the merchant’s end to PayU. It ranges from udf1 to udf5. |
udf3 |
This field contains the same value of udf values that were sent in the transaction request from the merchant’s end to PayU. It ranges from udf1 to udf5. |
udf4 |
This field contains the same value of udf values that were sent in the transaction request from the merchant’s end to PayU. It ranges from udf1 to udf5. |
udf5 |
This field contains the same value of udf values that were sent in the transaction request from the merchant’s end to PayU. It ranges from udf1 to udf5. |
field2, field3 |
The auth code from the bank is displayed in this field. |
field9 |
This field contains the failure reason if the transaction has failed. |
error_code |
This field contains the error code for the transaction. |
net_amount_debit |
This field contains the net amount debited from the customer’s account for this transaction. It is calculated as: |
added_on |
This field contains the transaction timestamp returned in this parameter. |
payment_source |
This field contains the payment source. PayU is returned for the transactions made with PayU. |
card_type |
This field contains the card type used for the transaction if the cards are used. |
error_Message |
This field contains the error message for the transaction (if any). |
net_amount_debit |
This field contains the net amount debited from the customer’s account for this transaction. |
disc |
This field contains the discount amount for the customer. |
Mode |
This field contains the mode of payment. |
PG_TYPE |
This field contains the information on the payment gateway used for the transaction. For example, if CC PG was used, it would contain the value CC-PG. Similarly, it would have a unique value for all different types of payment gateways. |
card_no |
This field contains the card number for card transactions. |
name_on_card |
This field contains the name on card for card transactions. |
udf2 |
This field contains the same value of udf values that were sent in the transaction request from the merchant’s end to PayU. It ranges from udf1 to udf5. |
field5 |
This field contains the UPI VPA ID for UPI transactions. |
status |
This field contains the status of the transaction. For detailed information on the statuses, refer to Payment State Explanations |
unmappedstatus |
This field contains the status of a transaction as per the internal database of PayU. PayU’s system has several intermediate statuses which are used for tracking various activities internal to the system. Hence, this status contains intermediate statuses of a transaction also – and hence is known as unmappedstatus. For detailed information on the statuses, refer to Payment State Explanations. |
Merchant_UTR |
This field contains the merchant Unique Transaction Reference (UTR) number. |
Settled_at |
This field contains the time stamp of card settlement if the transaction is using credit cards. |
Sample response
{
"msg": "1 out of 1 Transactions Fetched Successfully",
"transaction_details": {
"wtsapp_txn_id5": {
"mihpayid": "403993715529051451",
"request_id": null,
"bank_ref_num": null,
"amt": "2.00",
"transaction_amount": "2.00",
"txnid": "wtsapp_txn_id5",
"additional_charges": "0.00",
"productinfo": "WA productinfo",
"firstname": "WAfirstname",
"bankcode": "INTENT",
"udf1": null,
"udf3": null,
"udf4": null,
"udf5": "",
"field2": null,
"field9": null,
"error_code": null,
"addedon": "2023-05-31 18:56:08",
"payment_source": "payuPureS2S",
"card_type": null,
"error_Message": "",
"meCode": "{\"pgMerchantId\":\"HDFC000000000106\",\"payu_aggregator\":\"1\",\"merchantVpa\":\"payu@axisbank\"}",
"net_amount_debit": "0.00",
"disc": "0.00",
"mode": "UPI",
"PG_TYPE": "UPI-PG",
"card_no": "",
"udf2": null,
"status": "pending",
"unmappedstatus": "in progress",
"Merchant_UTR": null,
"Settled_At": null,
"App_Name": null
}
},
"status": 1.0
}
Failed Responses
Code | Reason | Response |
---|---|---|
401 |
with invalid token |
{ “message”: “Invalid Auth token” } |
403 |
with invalid hash |
{ “message”: “Invalid Hash” } |
400 |
without reseller_id |
{ “errors”: [ “reseller_id is mandatory.” ] } |
400 |
without merchant_id |
{ “errors”: [ “merchant_id is mandatory param” ] } |
400 |
without hash |
{ “errors”: [ “hash is mandatory param” ] } |
Step 4: PayU sends Server-to-Server call-back response
PayU can also send a server-to-server call-back 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:
mihpayid: 403993715523615328
mode: CC
status: success
unmappedstatus: captured
key: JPM7Fg
txnid: 50QJq6lBJBmx14
amount: 10.00
cardCategory: domestic
discount: 0.00
net_amount_debit: 10
addedon: 2021-07-28 15:11:37
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: afeab9dcf4e43d47f8fbf5a6838d393c70694a58e30ada08e6cb86ac943236c05717c5f5e4872d671fe81d0d9b2d9facd44e9a061ba621aff6f20c4343ea5dfa
field1:
field2:
field3:
field4:
field5:
field6:
field7:
field8:
field9: Transaction Completed Successfully
payment_source: payu
PG_TYPE: CC-PG
bank_ref_num: 7f0d5ada-59bb-41d7-9e41-20a6af2406c9
bankcode: CC
error: E000
error_message: No Error
name_on_card: test
cardnum: 411111XXXXXX1111