TPV with Android Core SDK
This section describes TPV integration with Android SDK platform.
Note:
For TPV transactions, you need to have a different Merchant ID. Contact your Key Account Manager at PayU for the same.
Step 1: Hash calculation
For TPV transactions, the hash calculation formula is different from the typical type of payment:
The account numbers should be separated by a pipe (|) character for multiple account numbers, and a maximum of four are allowed.β
Hash Formula:
// For single account number
beneficiarydetail = β{βbeneficiaryAccountNumberβ:β123456789β²}β
// For multiple account number
beneficiarydetail = β{βbeneficiaryAccountNumberβ:β123456789|54321234|98765673|34767988β²}β
// Hash calculation
Hash = sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||beneficiarydetail|SALT)
It is recommended to pass ifscCode for Net Banking, UPI, and TEZ TPV transactions. Hash calculation will include ifscCode similar to the following code block:
// For single ifsc code
beneficiarydetail = β{βbeneficiaryAccountNumberβ:β917732227242β²,βifscCodeβ:βSBIN000700β²}β
// For multiple ifsc number
beneficiarydetail = β{βbeneficiaryAccountNumberβ:β917732227242|72522762|283228235β²,βifscCodeβ:βSBIN000700|KTKN2937492|ICIC0002522β²}β
// Hash calculation
Hash = sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||beneficiarydetail|SALT)
Step 2: Make Payment
Net Banking
To pay using Net Banking, you need to pass payment params along with the following additional parameters:
mPaymentParams.setBeneficiaryAccountNumber("123456789");
mPaymentParams.setIfscCode("SBIN000700");
mPaymentParams.setBankCode("AXNBTPV");
mPaymentParams.beneficiaryAccountNumber = "123456789"
mPaymentParams.ifscCode = "SBIN000700"
mPaymentParams.bankCode = "AXNBTPV"
After setting the above parameters, you can get the payment post parameters using the following code snippet:
BeneficiaryDetails beneficiaryDetails = new BeneficiaryDetails();
beneficiaryDetails.setBeneficiaryName("John Doe");
beneficiaryDetails.setBeneficiaryAccountNumber("51234567890");
beneficiaryDetails.setBeneficiaryAccountType(BeneficiaryAccountType.SAVINGS);
beneficiaryDetails.setBeneficiaryIfsc("ICIC0006621")
SIParams siParams = new SIParams();
siParams.setBeneficiarydetail(beneficiaryDetails);
UPI
βTo pay using UPI, you need to pass beneficiary account number parameters similar to the following code snippet:
// For single account number
mPaymentParams.setBeneficiaryAccountNumber("123456789");
mPaymentParams.setIfscCode("SBIN000700");
// For multiple account numbers
mPaymentParams.setBeneficiaryAccountNumber("123456789|23456782|1234567");
mPaymentParams.setIfscCode("SBIN000700|KTKN2937492|ICIC0002522");
// For single account number
mPaymentParams.beneficiaryAccountNumber = "123456789"
mPaymentParams.ifscCode = "SBIN000700"
// For multiple account numbers
mPaymentParams.beneficiaryAccountNumber = "123456789|23456782|1234567"
mPaymentParams.ifscCode = "SBIN000700|KTKN2937492|ICIC0002522"
UPI collect
After setting the above parameters for a UPI Collect transaction, you can get the payment post parameters using the following code snippet:
β try {
mPostData = new PaymentPostParams(mPaymentParams, PayuConstants.UPITPV).getPaymentPostParams();
} catch (Exception e) {
e.printStackTrace();
}β
try {
mPostData = PaymentPostParams(mPaymentParams, PayuConstants.UPI).paymentPostParams
} catch (Exception e) {
e.printStackTrace();
}β
TEZ
β try {
mPostData = new PaymentPostParams(mPaymentParams, PayuConstants.TEZTPV).getPaymentPostParams();
} catch (Exception e) {
e.printStackTrace();
}
try {
mPostData = PaymentPostParams(mPaymentParams, PayuConstants.TEZ).paymentPostParams
} catch (Exception e) {
e.printStackTrace();
}
Updated 3 months ago