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();
        }