The RevolutPaymentsModuleInstance
interface exposes several payment methods and utility functions provided by the Revolut Checkout Widget. Use this interface to initialise payment flows, handle results, and control widget behaviour.
You obtain this instance by calling the .payments()
method on your RevolutCheckoutInstance
. Once you have the RevolutCheckout.payments()
module, you can invoke any of the available payment flows and utility functions described below.
Compared to the RevolutCheckoutInstance
, the RevolutCheckout.payments
module does not require initialisation with an order token. This means that you don't need to create an order before checkout. Instead, you will be able to pass a createOrder
callback to asynchronously create an order
when the user is ready to pay.
Before obtaining the payments instance, you pass RevolutPaymentsModuleOptions
into .payments()
:
const paymentInstance = await RevolutCheckout.payments({
locale: 'auto', // optional, defaults to 'auto'
mode: 'sandbox', // optional, defaults to 'prod'
publicToken: '<yourPublicApiKey>', // merchant public API key
})
Parameter | Description | Type | Required |
---|---|---|---|
locale | Controls the language of the text in the widget.Possible values
| String | No |
mode | Default value: prod . Controls which API environment handles requests. Possible values are:
| Enum | No |
publicToken | The merchant's Public API key used for authorisation. note For Sandbox use your corresponding API key. | String | Yes |
export interface RevolutPaymentsModuleInstance {
revolutPay: PaymentsModuleRevolutPayInstance
paymentRequest: PaymentsModulePaymentRequest
payByBank: PaymentsModulePayByBank
destroy(): void
setDefaultLocale(lang: Locale | 'auto'): void
}
Method | Description |
---|---|
revolutPay | Launches the Revolut Pay SDK. |
paymentRequest | Launches the Payment Request SDK for Apple Pay and Google Pay. |
payByBank | Launches the Pay by Bank SDK. |
Method | Description | Signature |
---|---|---|
destroy() | Manually clean up event listeners, timers, and UI elements. | () => void |
setDefaultLocale(lang) | Change widget default language dynamically. | (lang: Locale | 'auto') => void |
See an example with the revolutPay
method:
import RevolutCheckout from '@revolut/checkout'
const { revolutPay } = await RevolutCheckout.payments({
locale: 'auto', // optional, defaults to 'auto'
mode: 'sandbox', // optional, defaults to 'prod'
publicToken: '<yourPublicApiKey>', // merchant public API key
})