Wallets Integration
You can collect payments from customers with leading wallets using the Merchant Hosted integration. You need to ensure that CASH for the pg parameter and wallet code based on the desired wallet for the bankcode parameter is posted as mentioned in Collect Payment API - Merchant Hosted Checkout > Request Parameters.
Steps to Integrate
Before you begin:
Register for a account with PayU before you start integration. For more information, refer to Register for a Merchant Account.
Step 1: Initiate the payment with PayU
Post Request Syntax & Composition
<body>
<form action='https://test.payu.in/_payment' method='post'>
<input type="hidden" name="key" value="JP***g" />
<input type="hidden" name="txnid" value="t6svtqtjRdl34W" />
<input type="hidden" name="productinfo" value="iPhone" />
<input type="hidden" name="amount" value="10" />
<input type="hidden" name="email" value="[email protected]" />
<input type="hidden" name="firstname" value="Ashish" />
<input type="hidden" name="lastname" value="Kumar" />
<input type="hidden" name="pg" value="CASH" />
<input type="hidden" name="bankcode" value="PAYTM" />
<input type="hidden" name="surl" value="your own success url" />
<input type="hidden" name="furl" value="your own failure url" />
<input type="hidden" name="phone" value="9988776655β />
<input type="hidden" name="hash" value="eabec285da28fd0e3054d41a4d24fe9f7599c9d0b66646f7a9984303fd6124044b6206daf831e9a8bda28a6200d318293a13d6c193109b60bd4b4f8b09c90972" />
<input type="submit" value="submit"> </form>
</body>
</html>
Note
The above HTML code block is for Merchant Checkout integration on the Wallet call for the test environment.
Request Parameters
The following parameters vary for the Wallet payment mode in the Collect Payment API (**_payment** API). For the complete list of parameters and response, refer to Collect Payments API under API Reference.
Parameter | Description | Example |
---|---|---|
pg mandatory | String It defines the payment category using the Merchant Hosted Checkout integration. For a Wallet payment, "CASH" must be specified in the pg parameter. | CASH |
bankcode mandatory | String The merchant must post this parameter with the corresponding payment optionβs bank code value in it. For all the supported wallets, refer to Wallet Codes to understand exact value which needs to be passed against bankcode parameter. Reference: For the list of test wallets, refer to Test Cards, UPI ID and Wallets. | PAYTM |
Test Environment Limitation
You can test wallets with the following only:
- PayTM: Use bankcode=PAYTM and works only with mobile number 7777777777.
- PhonePe: Use bankcode=PHONEPE and use the Phonepe Pre-Prod app for testing purposes as described in the following PhonePe documentation. Download the app and register your mobile number and follow the instructions as described in the above PhonePe docs.
- Amazon: You can test using your original Amazon account details.
Error Handling
If any error message is displayed with an error code, refer to Error Codes to understand the reason for these error codes.
Sample request
curl -X POST "https://test.payu.in/_payment-H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d"key=J****g&txnid=aI1UM19ONxLgPz&amount=10.00&firstname=Ashish&[email protected]&phone=9876543210&productinfo=iPhone&pg=cash&bankcode=paytm&surl=https://apiplayground-response.herokuapp.com/&furl=https://apiplayground-response.herokuapp.com/&hash=6840ba0d1a14554f7ee5d20966dfbac6b221718e72dd823f05b6da01420286315b4956c28325898b66520b111604020ea2c547608606674766eb7e4164dc0baa"
Sample response
Array
(
[mihpayid] => 403993715527518775
[mode] => CASH
[status] => success
[unmappedstatus] => captured
[key] => J*****g
[txnid] => HC13glcAkssIkl
[amount] => 10.00
[discount] => 0.00
[net_amount_debit] => 10
[addedon] => 2022-10-21 17:45:24
[productinfo] => iPhone
[firstname] => Ashish
[lastname] =>
[address1] =>
[address2] =>
[city] =>
[state] =>
[country] =>
[zipcode] =>
[email] => [email protected]
[phone] => 9876543210
[udf1] =>
[udf2] =>
[udf3] =>
[udf4] =>
[udf5] =>
[udf6] =>
[udf7] =>
[udf8] =>
[udf9] =>
[udf10] =>
[hash] => 007435a716982c7f5eec5cff95701f65eb1bdbff8f852e461224e3b5e17126ad26bb3a3ffdb95cded6a87d3515fe86fc58925cad024595a4a6825adfed2dc436
[field1] =>
[field2] =>
[field3] =>
[field4] =>
[field5] =>
[field6] =>
[field7] =>
[field8] =>
[field9] => Transaction Completed Successfully
[payment_source] => payu
[PG_TYPE] => CASH-PG
[bank_ref_num] => 540898ed-72e7-40a8-a96e-f17de621cbb4
[bankcode] => CASH
[error] => E000
[error_Message] => No Error
[splitInfo] => {"splitStatus":"splitNotReceived","splitSegments":[]}
)
Step 2: Verify the payment
Verify the transaction details using the Verification APIs. For API reference, refer to Verify Payment API under API Reference.
Tip
The transaction ID that you posted in Step 1 with PayU must be used here.
Recommended integrations for Wallets
- Recurring Payments: Enable recurring payments or subscriptions for wallets. For more information, refer to Recurring Payments Integration.
- Offers: Configure offers for cards on Dashboard and then collect payments with offers. For more information, refer to Create an Instant Discount or Cashback Offer and Offers .
Updated about 8 hours ago