# TPV Integration

{% hint style="danger" %}
For TPV transactions, you need to have different Merchant ID. Please contact your Key Account Manager at PayU for the same.
{% endhint %}

## You can integrate TPV with Core SDK in below steps: <a href="#you-can-integrate-tpv-with-bizsdk-framework-in-below-steps" id="you-can-integrate-tpv-with-bizsdk-framework-in-below-steps"></a>

* ​[Hash Calculation](#hash-calculation)​
* ​[Make payment​‌](#make-payment)

## Hash Calculation <a href="#hash-calculation" id="hash-calculation"></a>

‌For TPV transaction, hash calculation formula is different from normal type of payment:

For multiple account number, account number should be pipe separated and max 4 account numbers are allowed.‌

#### Hash Formula: <a href="#hash-formula" id="hash-formula"></a>

```
// 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 NB, UPI and TEZ TPV transactions. Hash calculation will include ifscCode as shown below

```
// 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)
```

## Make Payment <a href="#make-payment" id="make-payment"></a>

### For NetBanking

‌To Pay using NetBanking, you need to pass payment params along with below additional params

{% tabs %}
{% tab title="Java" %}
```java
mPaymentParams.setBeneficiaryAccountNumber("123456789");
mPaymentParams.setIfscCode("SBIN000700");
mPaymentParams.setBankCode("AXNBTPV");
```
{% endtab %}

{% tab title="Kotlin" %}
```kotlin
mPaymentParams.beneficiaryAccountNumber = "123456789"
mPaymentParams.ifscCode = "SBIN000700"
mPaymentParams.bankCode = "AXNBTPV"
```
{% endtab %}
{% endtabs %}

‌After setting the above parameters, you can get the payment post params using below

{% tabs %}
{% tab title="Java" %}
```java
     try {
            mPostData = new PaymentPostParams(mPaymentParams, PayuConstants.NB).getPaymentPostParams();
        } catch (Exception e) {
            e.printStackTrace();
        }‌
```
{% endtab %}

{% tab title="Kotlin" %}
```kotlin
     try {
            mPostData = PaymentPostParams(mPaymentParams, PayuConstants.NB).paymentPostParams
        } catch (Exception e) {
            e.printStackTrace();
        }‌
```
{% endtab %}
{% endtabs %}

### **For UPI** <a href="#for-upi" id="for-upi"></a>

‌To Pay using UPI, you need to pass beneficiaryAccountNumber param as below

{% tabs %}
{% tab title="Java" %}
```java
// For single account number 
mPaymentParams.setBeneficiaryAccountNumber("123456789");
mPaymentParams.setIfscCode("SBIN000700");

// For multiple account numbers
mPaymentParams.setBeneficiaryAccountNumber("123456789|23456782|1234567");  
mPaymentParams.setIfscCode("SBIN000700|KTKN2937492|ICIC0002522");

```
{% endtab %}

{% tab title="Kotlin" %}
```kotlin
// For single account number 
mPaymentParams.beneficiaryAccountNumber = "123456789"
mPaymentParams.ifscCode = "SBIN000700"

// For multiple account numbers
mPaymentParams.beneficiaryAccountNumber = "123456789|23456782|1234567"  
mPaymentParams.ifscCode = "SBIN000700|KTKN2937492|ICIC0002522"

```
{% endtab %}
{% endtabs %}

#### For UPI Collect

After setting the above parameters for UPI Collect transaction, you can get the payment post params using below

{% tabs %}
{% tab title="Java" %}
```java
‌     try {
            mPostData = new PaymentPostParams(mPaymentParams, PayuConstants.UPI).getPaymentPostParams();
        } catch (Exception e) {
            e.printStackTrace();
        }‌
```
{% endtab %}

{% tab title="Kotlin" %}
```kotlin
     try {
            mPostData = PaymentPostParams(mPaymentParams, PayuConstants.UPI).paymentPostParams
        } catch (Exception e) {
            e.printStackTrace();
        }‌
```
{% endtab %}
{% endtabs %}

#### For TEZ&#x20;

For TEZ transaction, you can get the payment post params using below

{% tabs %}
{% tab title="Java" %}
```java
‌     try {
            mPostData = new PaymentPostParams(mPaymentParams, PayuConstants.TEZ).getPaymentPostParams();
        } catch (Exception e) {
            e.printStackTrace();
        }
```
{% endtab %}

{% tab title="Kotlin" %}
```kotlin
     try {
            mPostData = PaymentPostParams(mPaymentParams, PayuConstants.TEZ).paymentPostParams  
        } catch (Exception e) {
            e.printStackTrace();
        }
```
{% endtab %}
{% endtabs %}
