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.
The Revolut Pay Android SDK offers several methods for managing payment flows, handling user interactions, and adding UI components:
Method | Description | Parameters | Return type |
---|---|---|---|
init | Initialises the SDK. Must be called before any other SDK method. | environment , returnUri , merchantPublicKey , requestShipping , customer | void |
pay | Initiates the payment flow programmatically without a button. | context , orderToken , savePaymentMethodForMerchant , lifecycle , callback | void |
provideButton | Creates a Revolut Pay button instance, which you can add to your layout. | context , ButtonParams | RevolutPayButton |
providePromotionalBannerWidget | Creates a promotional banner widget for displaying offers. | context , PromoBannerParams , themeId | View |
createController | Creates a Controller instance to manage button-click events and payment flows. | clickHandler: (ConfirmationFlow) -> Unit , callback: OrderResultCallback | Controller |
setOrderToken | Passes the unique order token into the confirmation flow. | orderToken | - |
setSavePaymentMethodForMerchant | Flags that the customer's payment method should be saved for future use. | savePaymentMethodForMerchant | - |
continueConfirmationFlow | Proceeds to the payment confirmation step after the token is set. | - | - |
init
methodThe 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?
)
Parameter | Description | Format | Required |
---|---|---|---|
environment | This parameter specifies the environment in which the SDK operates. Default value: MAIN Possible values:
| Enum | 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. | String | Yes |
merchantPublicKey | The 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. | String | 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 (for more information, see: Implement Revolut Pay with Fast checkout). Default: false . | Boolean | No |
customer | A Customer object if you want to prefill user data in the payment flow. Only valid details are prefilled. | Customer | No |
pay
methodThis 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
)
Parameter | Description | Format | Required |
---|---|---|---|
context | The current Context (e.g. your Activity or Fragment ) from which the payment is initiated. | Context | Yes |
orderToken | The token for the order created via the Merchant API, passed to the SDK from your backend. | String | Yes |
savePaymentMethodForMerchant | If 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. | Boolean | No |
lifecycle | The Lifecycle of the component (e.g., Activity or Fragment ) that is initiating the payment. The SDK uses this to safely manage its own state. | Lifecycle | Yes |
callback | A callback that handles payment result events. See the OrderResultCallback interface for details on the available methods. | OrderResultCallback | Yes |
provideButton
methodCreates 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 |
ButtonParams
classA 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: NONE Possible values:
| Radius | Yes |
buttonSize | Defines the size of the button. Default value: LARGE Possible values:
| 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: NONE Possible values:
| BoxText | Yes |
boxTextCurrency | Defines the reward currency of the view which is shown under the Revolut Pay button. Default value: GBP Possible values:
| BoxTextCurrency | No |
VariantModes
classclass 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 Possible values:
| Enum | Yes |
darkMode | Defines the style of the button used when device is in the dark mode. Default value: Variant.DARK Possible values:
| Enum | Yes |
providePromotionalBannerWidget
methodCreates 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 |
PromoBannerParams
classclass PromoBannerParams(
transactionId: String,
currency: String,
paymentAmount: Long?,
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 | ISO 4217 3-letter currency code of the order. | String | 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 |
createController
methodGenerates 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.
Parameter | Description | Format | Required |
---|---|---|---|
setHandler | A 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) -> Unit | Yes |
setOrderResultCallback | A callback that handles payment result events. See the OrderResultCallback interface for details on the available methods. | OrderResultCallback | Yes |
setOrderToken
methodProvides 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
)
Parameter | Description | Format | Required |
---|---|---|---|
orderToken | The token from your server after calling the Create an order endpoint. Identifies the transaction to process. | String | Yes |
setSavePaymentMethodForMerchant
methodSets 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
)
Parameter | Description | Format | Required |
---|---|---|---|
savePaymentMethodForMerchant | If true , the customer gives permission for their payment method to be saved for future merchant-initiated transactions (e.g., subscriptions). Default is false . | Boolean | Yes |
continueConfirmationFlow
methodOnce 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
interfaceThe 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()
}
Method | Description | Parameters |
---|---|---|
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). | - |
Customer
classProviding customer data can simplify the checkout process or pre-fill user info.
class Customer(
name: String?,
email: String?,
phone: String?,
dateOfBirth: DateOfBirth?,
country: Country?
)
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 Country object containing customer's country code. | Country | No |
DateOfBirth
classclass 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 |
Country
classclass Country(
value: String
)
Parameter | Description | Format | Required |
---|---|---|---|
value | ISO 3166 2-letter country code associated with the customer. | String (2-letter, uppercase) | Yes |
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
).