# 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](/docs/guides/merchant/accept-payments/online-payments/revolut-pay/mobile/android).
:::

:::note
The Revolut Pay Native (`revolutpay`) and Revolut Pay Lite (`revolutpaylite`) SDK variants share the same classes, methods, and parameters documented on this page. Both variants also follow the same version numbering. Unless stated otherwise, all content applies to both variants.
:::

## 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.

```kotlin
RevolutPaymentsSDK.configure(
    configuration: RevolutPaymentsSDK.Configuration
)
```

| Parameter       | Description                                                                                              | Format                                                    | Required |
| --------------- | -------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | -------- |
| `configuration` | A `RevolutPaymentsSDK.Configuration` object containing the merchant public key and environment settings. | [`Configuration`](#revolutpaymentssdkconfiguration-class) | Yes      |

### `createController` method

Creates a `RevolutPaymentController` to handle payment flows. This method is where you define the logic for handling payment results.

```kotlin
// 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`](#paymentresult-interface) object. | `(PaymentResult) -> Unit` | Yes      |

### `pay` method (Controller)

Initiates the payment flow using the controller. This method is called on the `RevolutPaymentController` instance.

```kotlin
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`](#orderparams-class) | Yes      |

### `isRevolutAppInstalled` method

Checks if the Revolut Retail app is installed on the device.

```kotlin
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.

```kotlin
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.

```kotlin
// 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`.

```kotlin
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.

```kotlin
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`](#buttonparams-class) | Yes      |

### `providePromotionalBannerWidget` method

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

```kotlin
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`](#promobannerparams-class) | 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

```kotlin
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](https://business.revolut.com/settings/apis?tab=merchant-api) page. For the Sandbox environment use the [Sandbox API Public key](https://sandbox-business.revolut.com/settings/apis?tab=merchant-api). | `String`                           | Yes      |
| `environment`       | This parameter specifies the environment in which the SDK operates. **Possible values:** `PRODUCTION`, `SANDBOX`                                                                                                                                                                                      | [`Environment`](#environment-enum) | Yes      |

### `OrderParams` class

Contains all the parameters needed to initiate a payment.

```kotlin
data class OrderParams(
    val orderToken: String,
    val returnUri: Uri,
    val requestShipping: Boolean,
    val savePaymentMethodForMerchant: Boolean,
    val customer: Customer?,
    val preferredMode: PreferredMode? = null
)
```

| 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`](#customer-class)          | No       |
| `preferredMode`                | Defines which Revolut Pay sign-in flow is opened with priority when the checkout is opened. If not provided, defaults to `RETAIL`. For available values and SDK-variant behaviour, see [`PreferredMode`](#preferredmode-enum).  | [`PreferredMode`](#preferredmode-enum) | No       |


### `ButtonParams` class

A `ButtonParams` object defining how the button appears and behaves.

```kotlin
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`](#radius-enum)                                        | Yes      |
| `buttonSize`      | Defines the size of the button. Default value: `Size.LARGE`.                                                                                                    | [`Size`](#size-enum)                                            | Yes      |
| `variantModes`    | Defines the dark and light theme variants used in different display modes of the device.                                                                        | [`VariantModes`](#variantmodes-class)                           | 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`](#boxtext-enum)                                      | Yes      |
| `boxTextCurrency` | Defines the reward currency of the view which is shown under the Revolut Pay button. Default value: `BoxTextCurrency.GBP`.                                      | [`BoxTextCurrency`](#boxtextcurrency-and-revolutcurrency-enums) | No       |

### `VariantModes` class

```kotlin
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`](#variant-enum) | Yes      |
| `darkMode`  | Defines the style of the button used when device is in the dark mode. Default value: `Variant.DARK`.   | [`Variant`](#variant-enum) | Yes      |

### `PromoBannerParams` class

```kotlin
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. | `String`                                                        | Yes      |
| `currency`      | Currency of the order using the `RevolutCurrency` enum.                                                                                                                                                                                                                                                                                                                                                                  | [`RevolutCurrency`](#boxtextcurrency-and-revolutcurrency-enums) | 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`](#customer-class)                                   | No       |

:::warning
The [Create an order endpoint](/docs/api/merchant#create-order) 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](/docs/api/merchant#create-order).
:::

### `Customer` class

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

```kotlin
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`](#dateofbirth-class) | No       |
| `country`     | A `CountryCode` object containing customer's country code.                                     | [`CountryCode`](#countrycode-class) | No       |

### `DateOfBirth` class

```kotlin
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

```kotlin
class CountryCode(
    val value: String
)
```

| Parameter | Description                                                                                            | Format                         | Required |
| --------- | ------------------------------------------------------------------------------------------------------ | ------------------------------ | -------- |
| `value`   | [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166) 2-letter country code associated with the customer. | `String` (2-letter, uppercase) | Yes      |

:::note
**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.

```kotlin
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.

```kotlin
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.

```kotlin
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](#variantmodes-class).

```kotlin
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.

```kotlin
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.

```kotlin
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.
```

### `PreferredMode` enum

The `PreferredMode` enum defines which Revolut Pay sign-in flow is opened with priority when the checkout is opened.

```kotlin
@Parcelize
enum class PreferredMode : Parcelable {
    RETAIL,
    RETAIL_ONLY,
    BUSINESS,
    BUSINESS_ONLY
}
```

| Value | Description |
| ----- | ----------- |
| `RETAIL` | The Revolut Retail app is opened if installed. If not, the Revolut Business app is opened if installed. If neither is installed, the Revolut Pay web login page is shown. |
| `BUSINESS` | The Revolut Business app is opened if installed. If not, the Revolut Retail app is opened if installed. If neither is installed, the Revolut Pay web login page is shown. |
| `RETAIL_ONLY` | Opens the Revolut Retail app if installed, or the Retail sign-in flow in a WebView. The option to switch to Revolut Business is not displayed. |
| `BUSINESS_ONLY` | Opens the Revolut Business app if installed, or the Business sign-in flow in a WebView. The option to switch to Revolut Retail is not displayed. |


#### SDK-variant behaviour

The exact behaviour of `preferredMode` depends on which SDK variant you are using.

| Scenario | Revolut Pay Native | Revolut Pay Lite |
|----------|--------------------|-----------------|
| **Retail flow** | Displayed natively inside the merchant's app | Customer is redirected to the Revolut Retail app |
| **Business flow** | Customer is redirected to the Revolut Business app (if installed), or the Business web login | Customer is redirected to the Revolut Business app (if installed), or the Business web login |
| **Account switcher** | Only shown when the respective Revolut app is installed on the device | Only shown when the respective Revolut app is installed on the device |


:::note
**Saved payment method flow:** When the customer has a saved payment method enabled for frictionless checkout, the SDK always behaves as `RETAIL_ONLY`, regardless of the configured `preferredMode`. Saved payment method consent is currently supported only in the Retail flow.

**Merchant Initiated Transactions (MIT):** When `savePaymentMethodForMerchant` is `true`, the SDK respects the configured `preferredMode`.
:::


## 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.

```kotlin
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:

```xml
<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](#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`).
:::

---

## Troubleshooting

### Build fails with duplicate OSGI manifest resources

**Affected SDK versions:** `3.2.0+`

When updating to Revolut Pay Android SDK version `3.2.0` or later, your app build may fail during compilation if your project does not exclude duplicate OSGI manifest resources.

**Error:**

```text
Execution failed for task ':app:mergeDebugJavaResource'.
2 files found with path 'META-INF/versions/9/OSGI-INF/MANIFEST.MF'
```

**Solution:**

Add the following `packaging` block inside the `android { }` block of your app-level `build.gradle` file:

```groovy
android {
    // ... your existing configuration ...

    packaging {
        resources {
            excludes += [
                'META-INF/versions/9/OSGI-INF/MANIFEST.MF',
                'META-INF/versions/9/OSGI-INF/*.xml'
            ]
        }
    }
}
```