Install the widget
To install the Revolut Checkout Widget, you need to add RevolutCheckout to your checkout page in one of the following ways:
- Installing the widget's NPM package. This uses JavaScript modules to access the widget instance.
- Adding the embed script to the checkout HTML page. This adds
RevolutCheckoutto the browser's global window.
Installing the widget's NPM package
Install the RevolutCheckout.js NPM package and import the ES module later to your code.
You can easily do so by running the following command:
npm install @revolut/checkout
This will allow you to import the RevolutCheckout module to your code that will be used when initializing the widget in the next steps:
import RevolutCheckout from "@revolut/checkout"
RevolutCheckout("<token>", "prod").then((instance) => {
// work with instance
})