Token-based initialisation
Initialise the SDK with an order token to access card payment methods.
Token-based initialisation creates a RevolutCheckoutInstance for a specific order. Use this method when you create orders on your server before showing the checkout, and you need card field or card popup functionality.
Payment methods available:
| Payment method | Reference | Integration guide |
|---|---|---|
| Card field | SDK reference | Guide |
| Card pop-up | SDK reference | Guide |
Type signature
function RevolutCheckout(
token: string,
mode?: 'prod' | 'sandbox'
): Promise<RevolutCheckoutInstance>
Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
token | Order token from the Create an order response | string | Yes |
mode | API environment. Default: 'prod' | 'prod' | 'sandbox' | No |
Tip
The mode parameter must match the environment used to create the order.
Returns
Returns a Promise<RevolutCheckoutInstance> with the following methods:
interface RevolutCheckoutInstance {
createCardField: (options?: CardFieldOptions) => RevolutCheckoutCardField
payWithPopup: (options?: PopupOptions) => RevolutCheckoutInstance
setDefaultLocale: (locale: Locale) => void
destroy: () => void
}
createCardField- Create an embedded card input fieldpayWithPopup- Show a full-screen payment pop-upsetDefaultLocale- Change widget language dynamicallydestroy- Manually destroy the instance
Example
import RevolutCheckout from '@revolut/checkout'
const instance = await RevolutCheckout('order_token_here', 'prod')