Sample Codes

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> <button id="rzp-button1" class="btn btn-outline-dark btn-lg"><i class="fas fa-money-bill"></i> Own Checkout</button> <script src="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 block name: "Pay using HDFC Bank", instruments: [ { method: "card", issuers: ["HDFC"] }, { method: "netbanking", banks: ["HDFC"] }, ] }, other: { // name for other block name: "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 = new Razorpay(options); document.getElementById('rzp-button1').onclick = function (e) { rzp1.open(); e.preventDefault(); } </script> </html>

Show Ola Money Separately on Checkout🔗

Use the code given below to show Ola Money separately on Checkout:

Copyconfig: { display: { blocks: { banks: { name: 'Methods with Offers', instruments: [ { method: 'wallet', wallets: ['olamoney'] }] }, }, sequence: ['block.banks'], preferences: { show_default_blocks: true, }, }, }, };
show ola money on checkout

Show Amazon Pay Separately on Checkout🔗

Use the code given below to show Amazon Pay separately on Checkout:

Copyconfig: { display: { blocks: { banks: { name: 'Methods with Offers', instruments: [ { method: 'wallet', wallets: ['amazonpay'] }] }, }, sequence: ['block.banks'], preferences: { show_default_blocks: true, }, }, }, };

Show Most Used Methods🔗

Use the code given below to show most used methods on Checkout:

Copyconfig: { display: { blocks: { banks: { name: 'Methods with Offers', instruments: [ { method: 'wallet', wallets: ['amazonpay'] }, { method: 'upi' }, ], }, }, sequence: ['block.banks'], preferences: { show_default_blocks: true, }, }, }, };

Show Instruments of a Certain Bank Only🔗

Use the code given below to show the instruments of a certain bank only on Checkout:

Copyconfig: { display: { blocks: { banks: { name: 'Pay using HDFC banks', instruments: [ { method: 'netbanking', banks: ['HDFC'], }, { method: 'card', issuers: ['HDFC'], }, { method: 'wallet', wallets:['payzapp'] } ], }, }, sequence: ['block.banks'], preferences: { show_default_blocks: false, }, }, }, };
show instruments of a certain bank only

Highlight Instruments of a Certain Bank🔗

Use the code given below to highlight the instruments of a certain bank only on Checkout:

Copyconfig: { display: { blocks: { banks: { name: 'Pay using HDFC banks', instruments: [ { method: 'netbanking', banks: ['HDFC'], }, { method: 'card', issuers: ['HDFC'], }, { method: 'wallet', wallets:['payzapp'] } ], }, }, sequence: ['block.banks'], preferences: { show_default_blocks: true, }, }, }, };
highlight instruments of a certain bank

Reorder Payment Methods🔗

Use the code given below to reorder payment methods on Checkout:

Copyconfig: { display: { blocks: { banks: { name: 'All payment methods', instruments: [ { method: 'upi' }, { method: 'card' }, { method: 'wallet' }, { method: 'netbanking' }, { method: 'emi' } ], }, }, sequence: ['block.banks'], preferences: { show_default_blocks: false, }, }, }, };
reorder payment methods

Remove a Method from Checkout🔗

Use the code given below to remove a method from Checkout:

Copyconfig: { display: { hide: [ { method: 'emi' } ], preferences: { show_default_blocks: true, }, }, }, };
remove a method from checkout

Show Only a Certain Payment Method on Checkout🔗

Use the code given below to show only a certain payment method on Checkout:

UPI🔗

Copyconfig: { display: { blocks: { banks: { name: 'Pay via UPI', instruments: [ { method: 'upi' } ], }, }, sequence: ['block.banks'], preferences: { show_default_blocks: false, }, }, }, };
show only UPI on checkout

Card🔗

Copyconfig: { display: { blocks: { banks: { name: 'Pay via Card', instruments: [ { method: 'card' } ], }, }, sequence: ['block.banks'], preferences: { show_default_blocks: false, }, }, }, };
show only card on checkout
×