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 & SettingsWebsite and app settingsAPI 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.

  1. .
  2. .

Follow the integration steps given below to integrate the widget:

  1. 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>
  2. 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>
  3. 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 Dashboard
    const amount = 400000; //in paise
    window.onload = function() {
    const widgetConfig = {
    "key": key,
    "amount": amount,
    };
    const rzpAffordabilitySuite = new RazorpayAffordabilitySuite(widgetConfig);
    rzpAffordabilitySuite.render();
    }

key

mandatory

string API Key ID generated from the

. For example, rzp_test_XXXX00000XXXX.

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.

Preview the widget in test mode

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.

  1. Log in to the and navigate to Affordability in the Payment Products section.
  2. Choose Others as your website platform.
    Select website platform for widget
  3. Click Enable Widget in the Go live! section.
    Enable the widget
  4. 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.

Glimpse of the default widget

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


Was this page helpful?