Merchant Web SDKs
Payments.payByBank
doc

Payments.payByBank

The Pay by Bank module (PaymentsModulePayByBank) enables merchants to accept open banking transfers directly through the Revolut Checkout Widget.

tip

Module signature

type PaymentsModulePayByBank = (
options: PaymentsModulePayByBankOptions
) => PaymentsModulePayByBankInstance

PaymentsModulePayByBankInstance

Use the instance returned by invoking the module to control the widget lifecycle

MethodDescriptionSignature
show()Open the Pay by Bank widget.() => void
destroy()Close the widget and clean up resources.() => void

PaymentsModulePayByBankOptions

Configuration options for initialising the Pay by Bank flow.

OptionDescriptionTypeRequired
createOrderCallback 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
instantOnlyIf true, only banks with instant settlement support are listed. Default: false.booleanNo
onSuccessCallback when the payment is successfully completed(payload: { orderId: string }) => voidNo
onErrorCalled when the payment fails due to errors (e.g., declined payments).(payload: { error: RevolutCheckoutError; orderId: string }) => voidNo
onCancelCalled when the user cancels the payment flow. orderId may be undefined if order creation failed.(payload: { orderId: string | undefined }) => voidNo

Example usage

my-app.js
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()
Was this page helpful?