Revolut Pay Android SDK
This page contains information about the methods, parameters, and data types of the Revolut Pay Android SDK.
For step-by-step instructions on installing and integrating the SDK, see: Accept payments via Revolut Pay - Android.
SDK components
RevolutPaymentsSDK object
This is the main entry point for configuring the SDK.
RevolutPaymentsSDK.configure method
Initialises the SDK with the necessary configuration. This method must be called before any other SDK method, typically in your Application's onCreate() method.
RevolutPaymentsSDK.configure(
configuration: RevolutPaymentsSDK.Configuration
)
| Parameter | Description | Format | Required |
|---|---|---|---|
configuration | A RevolutPaymentsSDK.Configuration object containing the merchant public key and environment settings. | Configuration | Yes |
createController method
Creates a RevolutPaymentController to handle payment flows. This method is where you define the logic for handling payment results.
// For Activity
fun createController(
activity: ComponentActivity,
onResult: (PaymentResult) -> Unit
): RevolutPaymentController
// For Fragment
fun createController(
fragment: Fragment,
onResult: (PaymentResult) -> Unit
): RevolutPaymentController
| Parameter | Description | Format | Required |
|---|---|---|---|
activity | The ComponentActivity used to manage lifecycle and start payment flows. | ComponentActivity | Yes |
fragment | The Fragment used to manage lifecycle and start payment flows. | Fragment | Yes |
onResult | A callback function that handles payment result events. Receives a PaymentResult object. | (PaymentResult) -> Unit | Yes |
pay method (Controller)
Initiates the payment flow using the controller. This method is called on the RevolutPaymentController instance.
fun pay(orderParams: OrderParams)
| Parameter | Description | Format | Required |
|---|---|---|---|
orderParams | An OrderParams object containing all the payment details including order token, return URI, and customer information. | OrderParams | Yes |
isRevolutAppInstalled method
Checks if the Revolut Retail app is installed on the device.
fun isRevolutAppInstalled(context: Context): Boolean
| Parameter | Description | Format | Required |
|---|---|---|---|
context | The current Context used to check for app installation. | Context | Yes |
handle method
Handles deeplink URIs to trigger payment result callbacks when appropriate.
fun handle(uri: Uri)
| Parameter | Description | Format | Required |
|---|---|---|---|
uri | The deeplink URI to be handled by the SDK. | Uri | Yes |
bindPaymentState method (Button Extension)
Binds the payment state to a RevolutPayButton, automatically showing a loading indicator while the payment is processing.
// For Activity
fun RevolutPayButton.bindPaymentState(
controller: RevolutPaymentController,
activity: ComponentActivity
)
// For Fragment
fun RevolutPayButton.bindPaymentState(
controller: RevolutPaymentController,
fragment: Fragment
)
| Parameter | Description | Format | Required |
|---|---|---|---|
controller | The RevolutPaymentController instance to bind the payment state from. | RevolutPaymentController | Yes |
activity | The ComponentActivity used to manage the lifecycle for the binding. | ComponentActivity | Yes |
fragment | The Fragment used to manage the lifecycle for the binding. | Fragment | Yes |
showBlockingLoading method (Button)
Shows or hides a blocking loading indicator on the RevolutPayButton.
fun RevolutPayButton.showBlockingLoading(loading: Boolean)
| Parameter | Description | Format | Required |
|---|---|---|---|
loading | If true, shows the loading indicator and disables the button. If false, hides the loading indicator and enables the button. | Boolean | Yes |
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
| Parameter | Description | Format | Required |
|---|---|---|---|
context | The current Context (e.g. your Activity or Fragment) used to create the button view. | Context | Yes |
params | A ButtonParams object defining how the button appears and behaves. | ButtonParams | Yes |
providePromotionalBannerWidget method
Creates a promotional banner widget to display rewards and sign-up incentives.
fun providePromotionalBannerWidget(
context: Context,
params: PromoBannerParams,
themeId: Int? = 0
): View
| Parameter | Description | Format | Required |
|---|---|---|---|
context | The current Context (e.g. your Activity or Fragment) used to create the button view. | Context | Yes |
params | A PromoBannerParams object that defines how the banner is set up. | PromoBannerParams | Yes |
themeId | A custom theme resource for styling the banner. Defaults to 0 (the widget's default theme). | Int (resource ID) | No |
Data structures
RevolutPaymentsSDK.Configuration class
data class Configuration(
val merchantPublicKey: String,
val environment: Environment
)
| Parameter | Description | Format | Required |
|---|---|---|---|
merchantPublicKey | The merchant's public API key used for authorization, obtained from the Merchant API settings page. For the Sandbox environment use the Sandbox API Public key. | String | Yes |
environment | This parameter specifies the environment in which the SDK operates. Possible values: PRODUCTION, SANDBOX | Environment | Yes |
OrderParams class
Contains all the parameters needed to initiate a payment.
data class OrderParams(
val orderToken: String,
val returnUri: Uri,
val requestShipping: Boolean,
val savePaymentMethodForMerchant: Boolean,
val customer: Customer?
)
| Parameter | Description | Format | Required |
|---|---|---|---|
orderToken | The token for the order created via the Merchant API, passed to the SDK from your backend. | String | Yes |
returnUri | A URI that represents a deep link used by the Revolut app to return to your app after the payment is confirmed or rejected. | Uri | Yes |
requestShipping | If 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. Default: false. | Boolean | Yes |
savePaymentMethodForMerchant | If true, the customer gives permission for their payment method to be saved for future merchant-initiated transactions. Default is false. | Boolean | Yes |
customer | A Customer object if you want to prefill user data in the payment flow. Only valid details are prefilled. | Customer | No |
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,
)
| Parameter | Description | Format | Required |
|---|---|---|---|
radius | Defines the corner radius of the button. Default value: Radius.NONE. | Radius | Yes |
buttonSize | Defines the size of the button. Default value: Size.LARGE. | Size | Yes |
variantModes | Defines the dark and light theme variants used in different display modes of the device. | VariantModes | Yes |
boxText | Defines the appearance of the view which is shown under the Revolut Pay button for informing the user about the provided reward. Default value: BoxText.NONE. | BoxText | Yes |
boxTextCurrency | Defines the reward currency of the view which is shown under the Revolut Pay button. Default value: BoxTextCurrency.GBP. | BoxTextCurrency | No |
VariantModes class
class VariantModes(
lightMode: Variant = Variant.LIGHT,
darkMode: Variant = Variant.DARK
)
| Parameter | Description | Format | Required |
|---|---|---|---|
lightMode | Defines the style of the button used when device is in the light mode. Default value: Variant.LIGHT. | Variant | Yes |
darkMode | Defines the style of the button used when device is in the dark mode. Default value: Variant.DARK. | Variant | Yes |
PromoBannerParams class
data class PromoBannerParams(
val transactionId: String,
val currency: RevolutCurrency,
val paymentAmount: Long?,
val customer: Customer?
)
| Parameter | Description | Format | Required |
|---|---|---|---|
transactionId | The token of the order connected to the promotional offer. caution The Create an order endpoint was updated to a new version and now returns We strongly advise upgrading to the new Create an order endpoint. | String | Yes |
currency | Currency of the order using the RevolutCurrency enum. | RevolutCurrency | Yes |
paymentAmount | The amount to be paid by the customer, given in the lowest denomination (e.g. cents). | Long | No |
customer | A Customer object if you want to prefill user data in the banner flow. Only valid details are prefilled. | Customer | No |
Customer class
Providing customer data can simplify the checkout process or pre-fill user info.
class Customer(
val name: String?,
val email: String?,
val phone: String?,
val dateOfBirth: DateOfBirth?,
val country: CountryCode?
)
| Parameter | Description | Format | Required |
|---|---|---|---|
name | Customer's name. Example: 'Firstname Lastname' | String | No |
email | Customer's email. Example: 'example@email.com' | String | No |
phone | Customer's phone number, containing country code and '+' character. Example: '+441234567890' | String | No |
dateOfBirth | A DateOfBirth object containing customer's date of birth. | DateOfBirth | No |
country | A CountryCode object containing customer's country code. | CountryCode | No |
DateOfBirth class
class DateOfBirth(
day: Int,
month: Int,
year: Int
)
| Parameter | Description | Format | Required |
|---|---|---|---|
day | Customer's birth day. | Int (between 1-31) | Yes |
month | Customer's birth month. | Int (between 1-12) | Yes |
year | Customer's birth year. | Int (4 digits) | Yes |
CountryCode class
class CountryCode(
val value: String
)
| Parameter | Description | Format | Required |
|---|---|---|---|
value | ISO 3166 2-letter country code associated with the customer. | String (2-letter, uppercase) | Yes |
Available country codes: The CountryCode class provides predefined constants for all supported countries (e.g., CountryCode.US, CountryCode.GB, CountryCode.DE, etc.) or you can create a custom one using CountryCode.fromValue("US").
Enums
Environment enum
The Environment enum defines the possible server environments that the SDK can point to.
enum class Environment {
PRODUCTION,
SANDBOX
}
| Value | Description |
|---|---|
PRODUCTION | The live environment for processing real transactions. |
SANDBOX | The test environment for integration and development purposes. |
Radius enum
The Radius enum defines the corner radius of the Revolut Pay button.
enum class Radius {
NONE,
SMALL,
MEDIUM,
LARGE
}
| Value | Description |
|---|---|
NONE | No corner radius (sharp corners). |
SMALL | A small corner radius. |
MEDIUM | A medium corner radius. |
LARGE | A large corner radius. |
Size enum
The Size enum defines the width of the Revolut Pay button.
enum class Size {
EXTRA_SMALL,
SMALL,
MEDIUM,
LARGE
}
| Value | Description |
|---|---|
EXTRA_SMALL | An extra-small button. |
SMALL | A small button. |
MEDIUM | A medium-sized button. |
LARGE | A large button. |
Variant enum
The Variant enum defines the visual style of the Revolut Pay button, suitable for different themes. It is used within the VariantModes class.
enum class Variant {
DARK,
LIGHT,
DARK_OUTLINED,
LIGHT_OUTLINED
}
| Value | Description |
|---|---|
DARK | Dark background with light text. |
LIGHT | Light background with dark text. |
DARK_OUTLINED | Light background with a dark outline and text. |
LIGHT_OUTLINED | Dark background with a light outline and text. |
BoxText enum
The BoxText enum defines the text content of the informational box displayed beneath the Revolut Pay button.
enum class BoxText {
NONE,
GET_CASHBACK_VALUE
}
| Value | Description |
|---|---|
NONE | The informational box is not displayed. |
GET_CASHBACK_VALUE | Displays text related to getting rewards. |
BoxTextCurrency and RevolutCurrency enums
These enums define the supported ISO 4217 currency codes for use in transactions or for displaying rewards.
enum class BoxTextCurrency {
AED, AUD, BGN, CAD, CHF, CZK, DKK, EUR, GBP, HKD, HUF, ILS, JPY, MXN, NOK, NZD, PLN, QAR, RON, RUB, SAR, SEK, SGD, THB, TRY, USD, ZAR
}
// RevolutCurrency contains the same set of values.
Results
PaymentResult interface
The PaymentResult sealed interface represents the outcomes of the payment process. It is passed to the result callback when using the createController method.
sealed interface PaymentResult {
data object Success : PaymentResult
data class Failure(val exception: Throwable) : PaymentResult
data object UserAbandonedPayment : PaymentResult
}
| Result | Description | Properties |
|---|---|---|
Success | Called when the payment completes successfully. | - |
Failure | Called when the payment fails. Contains the exception with details about the error. | exception: Throwable |
UserAbandonedPayment | Called when the user cancels the payment (for example, by navigating back on the summary screen). | - |
UI components and layouts
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"
/>
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).