Integrate the Widget on Your Website
Integrate Affordability Widget on your Website to spread awareness about the affordability-based payment options before they reach checkout.
Integrate with Affordability Widget to influence your customer's purchase decisions before they reach checkout by displaying various affordable payment options and offers.
Handy Tips
Razorpay Affordability Widget is compatible with all Javascript frameworks like React, Vue, Angular, Svelte and so on.
- Create a .
- Generate the from the by navigating to Account & Settings → Website and app settings → API keys.
- You can use the Test Mode keys to test the integration and preview the Widget. Later, switch to Live Mode of the Razorpay Dashboard, generate the and replace it with the test keys.
Handy Tips
Only the Owner, Admin and Manager roles can enable the widget.
Follow the integration steps given below to embed the widget on your website.
- .
- .
Follow the integration steps given below to integrate the widget:
-
Embed the JavaScript file into your website. Copy the snippet and add it to the head section of your website.
<!-- Add script in head --><script src="https://cdn.razorpay.com/widgets/affordability/affordability.js"></script> -
Create an HTML element with the below id under the product price. This is to indicate where the affordability widget should appear.
<div id="razorpay-affordability-widget"> </div> -
Copy-paste the following snippet to the JS file and link it to your HTML file. Add the test key ID generated from the
.const key = "rzp_test_XXXX00000XXXX"; //Replace it with your Test Key ID generated from the Dashboardconst amount = 400000; //in paisewindow.onload = function() {const widgetConfig = {"key": key,"amount": amount,};const rzpAffordabilitySuite = new RazorpayAffordabilitySuite(widgetConfig);rzpAffordabilitySuite.render();}
key
mandatory
amount
mandatory
integer
The amount to be paid by the customer in paise. For example, if the amount is ₹4000, enter 400000
.
Watch Out!
Ensure you pass the final amount in paise to the widget which you want to display to your customers on the product and checkout pages.
You can now preview the widget on your product description page in test mode. Here is a glimpse of the default widget.
After you preview the widget, switch to live mode and replace the test API keys in the sample code with the live ones to take the integration live. Know more about
.Once you preview the widget on your product description page, you have to enable the widget to display it on your website for your customers.
- Log in to the and navigate to Affordability in the Payment Products section.
- Choose Others as your website platform.
- Click Enable Widget in the Go live! section.
- Select the check box if you consent to enable the widget and click Yes, enable.
Here is a glimpse of the default widget with offers and payment method options enabled.
Minimum Order Limit
All the payment method options that are enabled and that satisfy the minimum order limit appear on the widget. Know more about the minimum order limit for:
Feature Enablement
Raise a request with our
to integrate Razorpay Affordability Widget with Checkout. Your customers can select an offer/payment option on the widget, proceed to checkout and complete the payment.After you successfully integrate the widget on your website, you can choose to
based on your requirement.Handy Tips
- Fill in the in case you are facing any issues with the integration.
- In case you have any queries, raise a ticket on the .
Was this page helpful?