Merchant Android SDKs
Methods and parameters
doc

Revolut Merchant Card Form SDK

This page contains information about the available methods, parameters and data types of the Revolut Merchant Card Form SDK for Android.

info

For detailed instructions on how to install and integrate the SDK, see: Accept payments via Revolut Merchant Card Form SDK - Android.

SDK components

RevolutPaymentsSDK object

This is the main entry point for configuring the SDK.

RevolutPaymentsSDK.configure method

The 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
)
ParameterDescriptionFormatRequired
configurationA configuration object that specifies the environment and merchantPublicKey.ConfigurationYes

RevolutPaymentsSDK.Configuration class

This data class holds the configuration settings for the SDK.

class Configuration(
environment: Environment,
merchantPublicKey: String
)
ParameterDescriptionFormatRequired
environmentThis parameter specifies the environment in which the SDK operates. Default value: Envorinment.PRODUCTION

Possible values:
  • Environment.PRODUCTION
  • Environment.SANDBOX
EnvironmentYes
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

CardPaymentLauncher class

This 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
)
ParameterDescriptionFormatRequired
callerThe Activity or Fragment that will launch the payment flow. This component handles the startActivityForResult contract. Typically, you pass this.ActivityResultCallerYes
onResultA callback function that receives the final outcome of the payment operation.(CardPaymentResult) -> UnitYes

CardPaymentLauncher.launch method

This method starts the payment process, displaying the card form to the user.

fun launch(
params: CardPaymentParams
)
ParameterDescriptionFormatRequired
paramsA data object containing all the necessary information to start the payment, including the order token.CardPaymentParamsYes

Data classes

CardPaymentParams class

This 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?
)
ParameterDescriptionFormatRequired
orderIdThe unique token of the order, obtained from your server after creating an order. This identifies the transaction to be processed.StringYes
emailThe 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.StringNo
billingAddressObject containing data for the billing address. This is used to pre-fill the billing address on the payment form and can help reduce fraud.AddressParamsNo
shippingAddressObject containing data for the shipping address, used to pre-fill the shipping address on the payment form if applicable.AddressParamsNo
savePaymentMethodForThis parameter accepts a UserType enum, which indicates whether the payment method should be saved for the customer or merchant.

Possible values:
  • UserType.CUSTOMER - This method is used only when the customer is on the checkout page.
  • UserType.MERCHANT - This method can be used without the customer being on the checkout page, and the merchant can initiate transactions (e.g. take payments for recurring transactions). This method is saved as the new default payment method for merchant initiated transactions, regardless of the number of saved payment methods stored against the customer.
info
For more information, see: Charge a customer's saved payment method
UserTypeNo

AddressParams class

The 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?
)
ParameterDescriptionFormatRequired
streetLine1The primary street address line.StringNo
streetLine2The second line of the street address, such as a floor or apartment number.StringNo
cityThe city or locality of the address.StringNo
regionThe region or state within the country.StringNo
countryThe 2-letter country code of the country associated with the address.StringYes
postcodeThe postcode of the address.StringNo

Environment enum

The Environment enum defines the possible server environments that the SDK can point to.

enum class Environment {
PRODUCTION,
SANDBOX
}
ValueDescription
PRODUCTIONThe live environment for processing real transactions.
SANDBOXThe test environment for integration and development purposes.

UserType enum

The 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
}
ValueDescription
CUSTOMERThe payment method is saved for customer-initiated transactions.
MERCHANTThe payment method is saved for merchant-initiated transactions (e.g., recurring payments).

Results

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 object

Indicates that the payment was successfully authorised.

object Authorised : CardPaymentResult()

Declined object

Indicates that the payment was declined by the card issuer or payment network.

object Declined : CardPaymentResult()
info

For more information about the potential reasons for a decline, see: Decline reasons.

Failed object

Indicates that a technical failure occurred during the payment process (e.g., network issues).

object Failed : CardPaymentResult()

Error class

Indicates that an error occurred due to invalid input or configuration.

class Error(
errorCode: String,
errorMessage: String
) : CardPaymentResult()

UserAbandonedPayment object

Indicates that the user abandoned the payment (e.g., using a system back button, a back gesture, or a close button).

object UserAbandonedPayment : CardPaymentResult()
Was this page helpful?