Merchant Android SDKs
Methods and parameters
doc

Revolut Pay Android SDK

This page contains information about the methods, parameters, and data types of the Revolut Pay Android SDK.

info

For step-by-step instructions on installing and integrating the SDK, see: Accept payments via Revolut Pay - Android.

Methods and parameters

The Revolut Pay Android SDK offers several methods for managing payment flows, handling user interactions, and adding UI components:

MethodDescriptionParametersReturn type
initInitialises the SDK. Must be called before any other SDK method.environment, returnUri, merchantPublicKey, requestShipping, customervoid
payInitiates the payment flow programmatically without a button.context, orderToken, savePaymentMethodForMerchant, lifecycle, callbackvoid
provideButtonCreates a Revolut Pay button instance, which you can add to your layout.context, ButtonParamsRevolutPayButton
providePromotionalBannerWidgetCreates a promotional banner widget for displaying offers.context, PromoBannerParams, themeIdView
createControllerCreates a Controller instance to manage button-click events and payment flows.clickHandler: (ConfirmationFlow) -> Unit, callback: OrderResultCallbackController
setOrderTokenPasses the unique order token into the confirmation flow.orderToken-
setSavePaymentMethodForMerchantFlags that the customer's payment method should be saved for future use.savePaymentMethodForMerchant-
continueConfirmationFlowProceeds to the payment confirmation step after the token is set.--

init method

The init method is used to initialise the SDK with the necessary environment and authorisation settings. It sets up the SDK to interact with Revolut's payment services, ensuring that the app is configured correctly for processing transactions. You must call this before creating buttons or promotional widgets.

fun init(
environment: RevolutPayEnvironment,
returnUri: String,
merchantPublicKey: String,
requestShipping: Boolean?,
customer: Customer?
)
ParameterDescriptionFormatRequired
environmentThis parameter specifies the environment in which the SDK operates. Default value: MAIN

Possible values:
  • MAIN
  • SANDBOX
EnumYes
returnUriA URI that represents a deep link used by the Revolut app to return to your app after the payment is confirmed or rejected.StringYes
merchantPublicKeyThe merchant's public API key used for authorisation, obtained from the Merchant API settings page.

note
For the Sandbox environment use the Sandbox API Public key.
StringYes
requestShippingIf true, the shipping address and delivery method are quickly collected through Revolut Pay from the user. Your backend must support Fast checkout for this functionality to work (for more information, see: Implement Revolut Pay with Fast checkout). Default: false.BooleanNo
customerA Customer object if you want to prefill user data in the payment flow. Only valid details are prefilled.CustomerNo

pay method

This method allows you to initiate the Revolut Pay flow programmatically without requiring the user to tap a RevolutPayButton. This is useful for custom UI implementations where you want to trigger the payment from another element, like a generic checkout button.

fun pay(
context: Context,
orderToken: String,
savePaymentMethodForMerchant: Boolean = false,
lifecycle: Lifecycle,
callback: OrderResultCallback
)
ParameterDescriptionFormatRequired
contextThe current Context (e.g. your Activity or Fragment) from which the payment is initiated.ContextYes
orderTokenThe token for the order created via the Merchant API, passed to the SDK from your backend.StringYes
savePaymentMethodForMerchantIf true, the customer gives permission for their payment method to be saved for future merchant-initiated transactions. Default is false.

To learn more about merchant initiated transactions, see: Accept payments via Revolut Pay - Android: Advanced features.
BooleanNo
lifecycleThe Lifecycle of the component (e.g., Activity or Fragment) that is initiating the payment. The SDK uses this to safely manage its own state.LifecycleYes
callbackA callback that handles payment result events. See the OrderResultCallback interface for details on the available methods.OrderResultCallbackYes

provideButton method

Creates an instance of the Revolut Pay button, which you can programmatically add to your layout.

fun provideButton(
context: Context,
params: ButtonParams
): RevolutPayButton
ParameterDescriptionFormatRequired
contextThe current Context (e.g. your Activity or Fragment) used to create the button view.ContextYes
paramsA ButtonParams object defining how the button appears and behaves.ButtonParamsYes

ButtonParams class

A ButtonParams object defining how the button appears and behaves.

class ButtonParams(
radius: Radius = Radius.NONE,
buttonSize: Size = Size.LARGE,
variantModes: VariantModes,
boxText: BoxText = BoxText.NONE,
boxTextCurrency: BoxTextCurrency? = BoxTextCurrency.GBP,
)
ParameterDescriptionFormatRequired
radiusDefines the corner radius of the button. Default value: NONE

Possible values:
  • NONE
  • SMALL
  • MEDIUM
  • LARGE
RadiusYes
buttonSizeDefines the size of the button. Default value: LARGE

Possible values:
  • EXTRA_SMALL
  • SMALL
  • MEDIUM
  • LARGE
SizeYes
variantModesDefines the dark and light theme variants used in different display modes of the device.VariantModesYes
boxTextDefines the appearance of the view which is shown under the Revolut Pay button for informing the user about the provided reward. Default value: NONE

Possible values:
  • NONE
  • GET_CASHBACK_VALUE
BoxTextYes
boxTextCurrencyDefines the reward currency of the view which is shown under the Revolut Pay button. Default value: GBP

Possible values:
  • GBP
  • EUR
  • USD
BoxTextCurrencyNo
VariantModes class
class VariantModes(
lightMode: Variant = Variant.LIGHT,
darkMode: Variant = Variant.DARK
)
ParameterDescriptionFormatRequired
lightModeDefines the style of the button used when device is in the light mode. Default value: Variant.LIGHT

Possible values:
  • Variant.DARK
  • Variant.LIGHT
  • Variant.DARK_OUTLINED
  • Variant.LIGHT_OUTLINED
EnumYes
darkModeDefines the style of the button used when device is in the dark mode. Default value: Variant.DARK

Possible values:
  • Variant.DARK
  • Variant.LIGHT
  • Variant.DARK_OUTLINED
  • Variant.LIGHT_OUTLINED
EnumYes

providePromotionalBannerWidget method

Creates a promotional banner widget to display rewards and sign-up incentives.

fun providePromotionalBannerWidget(
context: Context,
params: PromoBannerParams,
themeId: Int? = 0
): View
ParameterDescriptionFormatRequired
contextThe current Context (e.g. your Activity or Fragment) used to create the button view.ContextYes
paramsA PromoBannerParams object that defines how the banner is set up.PromoBannerParamsYes
themeIdA custom theme resource for styling the banner. Defaults to 0 (the widget's default theme).Int (resource ID)No

PromoBannerParams class

class PromoBannerParams(
transactionId: String,
currency: String,
paymentAmount: Long?,
customer: Customer?
)
ParameterDescriptionFormatRequired
transactionIdThe token of the order connected to the promotional offer.
caution

The Create an order endpoint was updated to a new version and now returns token as the public identifier for the order. Previous integrations might still use the deprecated endpoint returning public_id.

We strongly advise upgrading to the new Create an order endpoint.

StringYes
currencyISO 4217 3-letter currency code of the order.StringYes
paymentAmountThe amount to be paid by the customer, given in the lowest denomination (e.g. cents).LongNo
customerA Customer object if you want to prefill user data in the banner flow. Only valid details are prefilled.CustomerNo

createController method

Generates a Controller to handle the payment flow, which you attach to a Revolut Pay button instance. This method is where you define the logic for handling the button tap and the final payment result.

fun RevolutPayButton.createController(): Controller

// Controller methods
fun Controller.setHandler(onClick: (ConfirmationFlow) -> Unit)
fun Controller.setOrderResultCallback(orderResultCallback: OrderResultCallback)

The typical flow is to create the controller, then use setHandler and setOrderResultCallback to manage the payment.

ParameterDescriptionFormatRequired
setHandlerA callback function invoked when the user taps the Revolut Pay button. It receives a ConfirmationFlow object, which you use to provide the order token and continue the payment.(ConfirmationFlow) -> UnitYes
setOrderResultCallbackA callback that handles payment result events. See the OrderResultCallback interface for details on the available methods.OrderResultCallbackYes

setOrderToken method

Provides the unique order token to the ConfirmationFlow. You fetch this token from your server after the user taps the Revolut Pay button.

fun ConfirmationFlow.setOrderToken(
orderToken: String
)
ParameterDescriptionFormatRequired
orderTokenThe token from your server after calling the Create an order endpoint. Identifies the transaction to process.StringYes

setSavePaymentMethodForMerchant method

Sets a flag indicating the customer's intent to save their payment method for future merchant-initiated transactions. Call this after setOrderToken.

fun ConfirmationFlow.setSavePaymentMethodForMerchant(
savePaymentMethodForMerchant: Boolean
)
ParameterDescriptionFormatRequired
savePaymentMethodForMerchantIf true, the customer gives permission for their payment method to be saved for future merchant-initiated transactions (e.g., subscriptions). Default is false.BooleanYes

continueConfirmationFlow method

Once the orderToken is set, call continueConfirmationFlow() to begin the actual payment confirmation. The user may switch to the Revolut app (if installed) or see an in-app web view.

fun ConfirmationFlow.continueConfirmationFlow()

OrderResultCallback interface

The OrderResultCallback interface is used to handle the outcomes of the payment process. Implement this interface to receive payment events in your UI.

interface OrderResultCallback {
fun onOrderCompleted()
fun onOrderFailed(throwable: Throwable)
fun onUserPaymentAbandoned()
}
MethodDescriptionParameters
onOrderCompleted()Called when the payment completes successfully.-
onOrderFailed(throwable: Throwable)Called when the payment fails. The throwable parameter provides details about the error.throwable: Throwable
onUserPaymentAbandoned()Called when the user cancels the payment (for example, by navigating back on the summary screen).-

Data structures

Customer class

Providing customer data can simplify the checkout process or pre-fill user info.

class Customer(
name: String?,
email: String?,
phone: String?,
dateOfBirth: DateOfBirth?,
country: Country?
)
ParameterDescriptionFormatRequired
nameCustomer's name. Example: 'Firstname Lastname'StringNo
emailCustomer's email. Example: 'example@email.com'StringNo
phoneCustomer's phone number, containing country code and '+' character. Example: '+441234567890'StringNo
dateOfBirthA DateOfBirth object containing customer's date of birth.DateOfBirthNo
countryA Country object containing customer's country code.CountryNo

DateOfBirth class

class DateOfBirth(
day: Int,
month: Int,
year: Int
)
ParameterDescriptionFormatRequired
dayCustomer's birth day.Int (between 1-31)Yes
monthCustomer's birth month.Int (between 1-12)Yes
yearCustomer's birth year.Int (4 digits)Yes

Country class

class Country(
value: String
)
ParameterDescriptionFormatRequired
valueISO 3166 2-letter country code associated with the customer.String (2-letter, uppercase)Yes

XML layout configuration for the Revolut Pay button

Instead of creating the button from Kotlin/Java, you can embed it directly in an XML layout:

<com.revolut.revolutpay.ui.button.RevolutPayButton
android:id="@+id/revolut_pay_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:revolutPay_Radius="Medium"
app:revolutPay_Size="Large"
app:revolutPay_BoxText="GetCashbackValue"
app:revolutPay_BoxTextCurrency="GBP"
app:revolutPay_VariantDarkTheme="Dark"
app:revolutPay_VariantLightTheme="Light"
/>
note

For details on the equivalent parameters, see ButtonParams class. The attribute names mirror those class properties (e.g., revolutPay_Radius = radius). The XML attribute values are case-insensitive (e.g. Medium or medium).

Was this page helpful?