The Pay by Bank module (PaymentsModulePayByBank
) enables merchants to accept open banking transfers directly through the Revolut Checkout Widget.
For more information about the integration process, see: Accept payment via Pay by Bank.
type PaymentsModulePayByBank = (
options: PaymentsModulePayByBankOptions
) => PaymentsModulePayByBankInstance
Use the instance returned by invoking the module to control the widget lifecycle
Method | Description | Signature |
---|---|---|
show() | Open the Pay by Bank widget. | () => void |
destroy() | Close the widget and clean up resources. | () => void |
Configuration options for initialising the Pay by Bank flow.
Option | Description | Type | Required |
---|---|---|---|
createOrder | Callback to create an order on your backend. Must resolve with { publicId } that representing the order token from the response of the Create an order endpoint. | () => Promise<{ publicId: string }> | Yes |
instantOnly | If true , only banks with instant settlement support are listed. Default: false . | boolean | No |
onSuccess | Callback when the payment is successfully completed | (payload: { orderId: string }) => void | No |
onError | Called when the payment fails due to errors (e.g., declined payments). | (payload: { error: RevolutCheckoutError; orderId: string }) => void | No |
onCancel | Called when the user cancels the payment flow. orderId may be undefined if order creation failed. | (payload: { orderId: string | undefined }) => void | No |
import RevolutCheckout from '@revolut/checkout'
const { payByBank } = await RevolutCheckout.payments({
locale: 'en', // Optional, defaults to 'auto'
publicToken: '<yourPublicApiKey>', // Merchant public API key
})
const payByBankInstance = payByBank({
createOrder: async () => {
// Call your backend here to create an order and return order.token
// For more information, see: https://developer.revolut.com/docs/merchant/create-order
const order = await yourServerSideCall()
return { publicId: order.token }
},
instantOnly: true,
onSuccess() {
// Do something to handle successful payments
window.alert('Successful payment!')
},
onError(error) {
// Do something to handle payment errors
window.alert(`Something went wrong. ${error}`)
},
onCancel() {
// Do something to handle cancelled payments
window.alert('The payment was cancelled.')
}
})
payByBankInstance.show()