Supported Payment Types
You can integrate with the following types of payments using React Native Core API:
- Credit/Debit Card
- Sodexo
- Saved Card
- Net Banking
- Cashcard/Wallet
- EMI
- No-cost EMI/Subvention EMI
- InApps UPIs
Generate URL request for payment
To generate the URL Request (and post parameters) for payment, create a JSON as shown in the code snippet below:
letβ―propsβ―= {β―
merchantKey,β―
salt,β―
isSandbox,β―
environment,β―
productInfo,β―
amount,β―
txnId,β―
firstName,β―
phone,β―
email,β―
surl,β―
furl,β―
userCredentials,β―
}β―;
The callbacks give your URLRequest as well as post parameters (NSString format). You can use these post parameters to initialize the Custom Browser Instance.
Build Request Data Objects for Payment Types
Credit/Debit Card
To pay using a credit/debit card, set the parameters as shown in the code snippet below:
constβ―requestDataβ―= {β―
...props,β―
key:β―props.merchantKey,β―
paymentType:β―'Credit / Debit Cards',β―
nameOnCard,
cardNumber,
expiryYear,
expiryMonth,
cvv,
cardToken,//not mandatory
};
Sodexo
To Pay using Sodexo, set the Sodexo parameter as shown in the code snippet below:
constβ―requestDataβ―= {β―
...props,β―
key:β―props.merchantKey,β―
paymentType:β―'Sodexo',β―
nameOnCard,
cardNumber,
expiryYear,
expiryMonth,
cvv,
};
After a successful payment, you will get the Sodexo source ID in the field3 param of PayU response that can be used to show and get stored Sodexo card details and can also be used for initiating payment.
SavedCard
To Pay usingβ― SavedCard, setβ―theSavedCard
β―parameter as shown in the code snippet below:
constβ―requestDataβ―= {β―
...props,β―
key:β―props.merchantKey,β―
paymentType: 'Credit / Debit Cards',β―
nameOnCard,
cvv,
cardToken,
}
Net Banking
To Pay usingβ―NetBanking, setβ―theNetBankingβ―
parameter as shown in the code snippet below:
constβ―requestDataβ―= {β―
...props,β―
key:β―props.merchantKey,β― //"smsplus"
paymentType:β―'Net Banking',β―
bankCode,β― //"SBIB"
}
Cashcard/Wallet
To Pay usingβ―CashCard, set thecashcard
parameter as shown in the code snippet below:
constβ―requestDataβ―= {β―
...props,
key: props.merchantKey, //"smsplus"
bankCode:BankCode, //"AMZPAY"
paymentType:"CASH",
}
EMI
To Pay using EMI, set the EMI parameter as shown in the code snippet below:
constβ―requestDataβ―= {β―
...props,
key: props.merchantKey, //"smsplus" //Mandatory
paymentType: 'EMI', //Mandatory
nameOnCard,
cardNumber,
expiryYear,
expiryMonth,
cvv,
bankCode,//"HDFCD06" //Mandatory
phone: phoneNumber
}
The following are the mandatory parameters for EMI:
- Credit Card EMI
- All Banks: cardNumber, expiryYear, expiryMonth, Cvv\
- Debit Card EMI
- Axis Bank and ICICI Bank: cardNumber, expiryYear, expiryMonth, Cvv, phone
- Bank of Baroda, HDFC Bank, Kotak Mahindra Banks, SBI: cardNumber, phone
- Cardless EMI
- ZestMoney: Phone
UPI
To Pay using UPI, set the UPI parameter as shown in the code snippet below:
constβ―requestDataβ―= {β―
...props,β―
key:β―props.merchantKey,β―
paymentType:β―'upi',β―
vpaβ―
}
No Cost EMI / Subvention EMIβ―
To Pay using Subvention EMI, setβ―the subventionAmount
β―parameter ofβ―paymentParams as shown in the code snippet below:
constβ―requestDataβ―= {β―
...props,β―
key:β―props.merchantKey,β―
paymentType:β―'No Cost EMI',β―
nameOnCard,β―
cardNumber,β―
expiryYear,β―
expiryMonth,β―
cvv,β―
bankCode,β―
subventionAmountβ―
}
Ifβ―subventionAmountβ―is passed in the request then use the following formula to calculate the hash: sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT|SubventionAmount)
InApps UPI
For UPI inApps, set paymentparameters
as shown in the code snippet below:
constβ―requestDataβ―= {β―
...props,
key: props.merchantKey, //"smsplus"
bankCode:BankCode,
paymentType:"",
}
Make the payment
After building the payment request data, use the makePaymen
tβ―method to create the request body as shown in the code snippet below:
PayUSdk.makePayment(β―
{β―
...requestData,β―
hash:β―getHash(requestData)β―
},β―
(response) => {β―
constβ―responseDataβ―=β―JSON.parse(response);β―
if (responseData?.data) {β―
//you get data andβ―urlβ―inβ―responseDataβ―
}β―
},β―
(err) => {β―
Alert.alert('Error',β―JSON.stringify(err));β―
}β―
);β―
Updated 12 months ago