Sample codes to help you integrate the payment methods of your choice on Razorpay Checkout.
If you want to list all the payment methods offered by HDFC bank, allow card payments for ICICI bank only and hide upi payment method from the Checkout, you can do so as follows:
Copy<html><buttonid="rzp-button1"class="btn btn-outline-dark btn-lg"><iclass="fas fa-money-bill"></i> Own Checkout</button><scriptsrc="https://checkout.razorpay.com/v1/checkout.js"></script><script>var options = {
"key": "[YOUR_KEY_ID]", // Enter the Key ID generated from the Dashboard"amount": "1000",
"currency": "INR",
"description": "Acme Corp",
"image": "https://s3.amazonaws.com/rzp-mobile/images/rzp.png",
"prefill":
{
"email": "gaurav.kumar@example.com",
"contact": +919900000000,
},
config: {
display: {
blocks: {
hdfc: { //name for HDFC blockname: "Pay using HDFC Bank",
instruments: [
{
method: "card",
issuers: ["HDFC"]
},
{
method: "netbanking",
banks: ["HDFC"]
},
]
},
other: { // name for other blockname: "Other Payment modes",
instruments: [
{
method: "card",
issuers: ["ICIC"]
},
{
method: 'netbanking',
}
]
}
},
hide: [
{
method: "upi"
}
],
sequence: ["block.hdfc", "block.other"],
preferences: {
show_default_blocks: false// Should Checkout show its default blocks?
}
}
},
"handler": function (response) {
alert(response.razorpay_payment_id);
},
"modal": {
"ondismiss": function () {
if (confirm("Are you sure, you want to close the form?")) {
txt = "You pressed OK!";
console.log("Checkout form closed by the user");
} else {
txt = "You pressed Cancel!";
console.log("Complete the Payment")
}
}
}
};
var rzp1 = newRazorpay(options);
document.getElementById('rzp-button1').onclick = function (e) {
rzp1.open();
e.preventDefault();
}
</script></html>