Integration
(Mandatory Step)
TPV SDK can be integrated by following below mentioned steps:
1.Include the SDK in your app project (Mandatory Step)
The TPV SDK is offered via npm.
Use below step to include PayU TPV SDK in your app:
Next, add the following imports in the class where you need to initiate a payment
For iOS
TPV SDK is a dynamic framework. If you are not using 'use_frameworks!', then please add the following line at the end of your podfile.
After updating the podfile, install the pod using below command.
2. Hash Calculation (Mandatory Step)
2.1 Payment Hash
For NB: Only single account number and corresponding IFSC code(if available) need to be passed.
For UPI: Multiple account number and corresponding IFSC code(if available) can be passed with pipe separated. IFSC codes must be in the exact same order as account numbers ie. IFSC1 must map to AccountNo1 and so on.
For single account number, we have explained the hash calculation above.
For multiple account account number, hash can be calculated as below:
For multiple account number, account number should be pipe separated and max 4 account numbers are allowed.
2.2 ValidateVpa Hash
This hash is used for validateVPA API. Hash formula is described below:
3.Payment param definition
Q: Why IFSC code is needed?
A: IFSC code is not a mandatory param. This increases the success rate of transactions.Therefore, we recommend you to pass ifsc code corresponding to account number.
Q: How this will increase success rate?
A: PayU will fetch the account number length corresponding to ifsc code and prefix zero before the passed account number if needed. Hence, account number mismatch error chances decreases.
To initiate a payment, your app will need to send transactional information to the TPV SDK.
Payment Params:
Parameter
Type
Description
Data Type & Validation
Mandatory
key
String
Merchant key received from PayU
Can not be null or empty
Yes
transactionId
String
It should be unique for each transaction
Can not be null or empty and should be unique for each transaction. It can not contain special characters like :-_/
Yes
amount
String
Total transaction amount
Can not be null or empty and should be valid double stringified eg, “100.0”
Yes
productInfo
String
Information about product
Can not be null or empty
Yes
firstName
String
Customer’s first name
Can not be null or empty
Yes
String
Customer’s email id
Can not be null or empty
Yes
phone
String
Customer’s phone number
Should be a valid phone number
Yes
ios_surl
String
[iOS] When the transaction gets success, PayU will load this url and pass transaction response
Should be a valid URL
Yes
ios_furl
String
[iOS] When the transaction gets fail, PayU will load this url and pass transaction response
Should be a valid URL
Yes
environment
String
Environment of SDK
"0" for Production and "1" for Test
Yes
beneficiaryAccountNumber
String
Customer bank account number
Should not be null
In NetBanking: only 1 account number can be passed. Eg: "5463546284"
In UPI:
Max 4 account number can be passed
Eg: "5436478356" or "765374657|2376547834|476374"
Yes
beneficiaryIFSC
String
Customer Bank account IFSC
If passed, then it should be correct customer bank IFSC code.
Eg: "PUNB0001000"
No
upiType
Int
It defines the type of upi payment
Eg: 1 for intent
0 for collect
Mandatory in case of UPI collect and intent
intentApp
String
Type of intent app. Currently we support gpay and phonepe
Eg: "gpay" for Google Pay
"phonepe" for PhonePe
Mandatory in case of UPI intent
vpa
String
Customer Account VPA
Eg: "umang@icic"
Mandatory in case of UPI collect and validateVPA API
bankCode
String
Bank code of bank from which user wants to pay
Eg: "ICINBTPV" for ICIC Netbanking
Mandatory in case of payment via NB
Hashes:
Parameter
Type
Description
payment
String
While doing payment this need to be set
validateVPA
String
Set this param while calling validateVPA API
Additional Params:
Additional params are optional params that can be passed to SDK like udf params. Below is list of params that can be passed in additional params -
Parameter
Type
Description
Mandatory
udf1
String
User defined field, Merchant can store their customer id, etc.
No
udf2
String
User defined field, Merchant can store their customer id, etc.
No
udf3
String
User defined field, Merchant can store their customer id, etc.
No
udf4
String
User defined field, Merchant can store their customer id, etc.
No
udf5
String
User defined field, Merchant can store their customer id, etc.
No
4. Make Payment
4.1 UPI Collect:
To pay using UPI collect set the paymentObject as below:
After making the paymentObject pass the same in "makeUPIPayment" method, if there is any error it will come under errorCompletion block and once payment get's success or fail it will come successCompletion block.
This can be integrated as below:
4.2 UPI Intent:
To pay using UPI intent set the paymentObject as below:
After making the payment object pass the same in "makeUPIPayment" method, if there is any error it will come under errorCompletion block and once payment get's success or fail it will come successCompletion block.
This can be integrated as below:
4.3 Get Netbanking Param
To get Netbanking param set the paymentObject as below:
After making the paymentObject pass the same in "getNBParam" method, if there is any error it will come under errorCompletion block and if not url and body param will come in successCompletion block.
This can be integrated as below:
5.API
5.1 ValidateVPA
This API is used to validate the vpa and get the name associated with the given vpa.
Set the paymentObject as below:
After setting paymentObject call validateVPA API as below:
After making the paymentObject pass the same in "validateVPA" method, if there is any error it will come under errorCompletion block and if not API response will come in successCompletion block.
This can be integrated as below:
6. Helper Methods
6.1 Supported IntentApp
This method will help in getting list of PSP apps which are supported by PayU and installed in user's device.
To get list of supported intentApp call intentApps method as below:
The app name which you get in this list should be passed in intentApp
parameter while doing intent payment.
Native Changes For iOS
For UPI Intent (Optional Step)
Currently we support only PhonePe and GooglePay via Intent. Add the query schemes in info.plist
Distributing your app (App Store / Ad-hoc) (Mandatory Step)
What you get by default is a fat framework that allows you to test your app seamlessly on device as well as simulator. But before archiving your app, you need to remove simulator slices from the framework. Please see the doc which assists in archiving your app with TPV integrated.
Last updated