This page contains information about the available methods, parameters and data types of the Revolut Merchant Card Form SDK for Android.
For detailed instructions on how to install and integrate the SDK, see: Accept payments via Revolut Merchant Card Form SDK - Android.
RevolutPaymentsSDK
objectThis is the main entry point for configuring the SDK.
RevolutPaymentsSDK.configure
methodThe configure
method is used to initialise the SDK with your merchant public key and the desired environment. It must be called once before performing any payment operations, typically in your application's onCreate
method.
fun configure(
configuration: Configuration
)
Parameter | Description | Format | Required |
---|---|---|---|
configuration | A configuration object that specifies the environment and merchantPublicKey . | Configuration | Yes |
RevolutPaymentsSDK.Configuration
classThis data class holds the configuration settings for the SDK.
class Configuration(
environment: Environment,
merchantPublicKey: String
)
Parameter | Description | Format | Required |
---|---|---|---|
environment | This parameter specifies the environment in which the SDK operates. Default value: Envorinment.PRODUCTION Possible values:
| Environment | 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 |
CardPaymentLauncher
classThis class handles the presentation of the payment UI and delivers the final result. You must register it as a member variable in your Activity
or Fragment
.
class CardPaymentLauncher(
caller: ActivityResultCaller,
onResult: (CardPaymentResult) -> Unit
)
Parameter | Description | Format | Required |
---|---|---|---|
caller | The Activity or Fragment that will launch the payment flow. This component handles the startActivityForResult contract. Typically, you pass this . | ActivityResultCaller | Yes |
onResult | A callback function that receives the final outcome of the payment operation. | (CardPaymentResult) -> Unit | Yes |
CardPaymentLauncher.launch
methodThis method starts the payment process, displaying the card form to the user.
fun launch(
params: CardPaymentParams
)
Parameter | Description | Format | Required |
---|---|---|---|
params | A data object containing all the necessary information to start the payment, including the order token . | CardPaymentParams | Yes |
CardPaymentParams
classThis data class is used to pass all required and optional information to the launch
method.
class CardPaymentParams(
orderId: String,
email: String?,
billingAddress: AddressParams?,
shippingAddress: AddressParams?,
savePaymentMethodFor: UserType?
)
Parameter | Description | Format | Required |
---|---|---|---|
orderId | The unique token of the order, obtained from your server after creating an order. This identifies the transaction to be processed. | String | Yes |
email | The email address of the customer, which can be pre-filled on the payment form. If not provided, the customer will be prompted to enter it. | String | No |
billingAddress | Object containing data for the billing address. This is used to pre-fill the billing address on the payment form and can help reduce fraud. | AddressParams | No |
shippingAddress | Object containing data for the shipping address, used to pre-fill the shipping address on the payment form if applicable. | AddressParams | No |
savePaymentMethodFor | This parameter accepts a UserType enum, which indicates whether the payment method should be saved for the customer or merchant. Possible values:
info For more information, see: Charge a customer's saved payment method | UserType | No |
AddressParams
classThe AddressParams
class represents an address used for billing or shipping purposes. Providing accurate address information can help reduce the likelihood of transaction declines and improve overall payment success rates.
class AddressParams(
streetLine1: String?,
streetLine2: String?,
city: String?,
region: String?,
country: String?,
postcode: String?
)
Parameter | Description | Format | Required |
---|---|---|---|
streetLine1 | The primary street address line. | String | No |
streetLine2 | The second line of the street address, such as a floor or apartment number. | String | No |
city | The city or locality of the address. | String | No |
region | The region or state within the country. | String | No |
country | The 2-letter country code of the country associated with the address. | String | Yes |
postcode | The postcode of the address. | String | No |
Environment
enumThe 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. |
UserType
enumThe UserType
enum specifies for whom a payment method should be saved, distinguishing if the payment method can be used for customer-initiated or merchant-initiated transactions.
enum class UserType {
CUSTOMER,
MERCHANT
}
Value | Description |
---|---|
CUSTOMER | The payment method is saved for customer-initiated transactions. |
MERCHANT | The payment method is saved for merchant-initiated transactions (e.g., recurring payments). |
The CardPaymentResult
is a sealed class that represents the outcome of a payment operation. It is delivered to the onResult
callback of the CardPaymentLauncher
.
Authorised
objectIndicates that the payment was successfully authorised.
object Authorised : CardPaymentResult()
Declined
objectIndicates that the payment was declined by the card issuer or payment network.
object Declined : CardPaymentResult()
For more information about the potential reasons for a decline, see: Decline reasons.
Failed
objectIndicates that a technical failure occurred during the payment process (e.g., network issues).
object Failed : CardPaymentResult()
Error
classIndicates that an error occurred due to invalid input or configuration.
class Error(
errorCode: String,
errorMessage: String
) : CardPaymentResult()
UserAbandonedPayment
objectIndicates that the user abandoned the payment (e.g., using a system back button, a back gesture, or a close button).
object UserAbandonedPayment : CardPaymentResult()