Merchant Web SDKs
The payments object
doc

The payments object

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.

Module options

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
})
ParameterDescriptionTypeRequired
localeControls the language of the text in the widget.

Possible values
  • auto (default) - Detect using browser locale,
  • en (English)
  • en-US (English - US),
  • es (Spanish),
  • de (German),
  • fr (French),
  • it (Italian),
  • nl (Dutch),
  • pl (Polish),
  • pt (Portuguese),
  • cs (Czech),
  • hu (Hungarian),
  • sk (Slovak),
  • ja (Japanese),
  • sv (Swedish),
  • bg (Bulgarian),
  • el (Greek),
  • ro (Romanian),
  • ru (Russian),
  • lt (Lithuanian),
  • hr (Croatian)
StringNo
modeDefault value: prod. Controls which API environment handles requests.

Possible values are:
  • sandbox
  • prod
EnumNo
publicTokenThe merchant's Public API key used for authorisation.

note
For Sandbox use your corresponding API key.
StringYes

Interface definition

export interface RevolutPaymentsModuleInstance {
revolutPay: PaymentsModuleRevolutPayInstance
paymentRequest: PaymentsModulePaymentRequest
payByBank: PaymentsModulePayByBank
destroy(): void
setDefaultLocale(lang: Locale | 'auto'): void
}

Feature overview

Payment flows

MethodDescription
revolutPayLaunches the Revolut Pay SDK.
paymentRequestLaunches the Payment Request SDK for Apple Pay and Google Pay.
payByBankLaunches the Pay by Bank SDK.

Utilities

MethodDescriptionSignature
destroy()Manually clean up event listeners, timers, and UI elements.() => void
setDefaultLocale(lang)Change widget default language dynamically.(lang: Locale | 'auto') => void

Example usage

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
})
Was this page helpful?