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.

Methods and parameters

The following methods are available on the RevolutPaymentApi class:

MethodDescriptionParametersReturn typeExceptions
initInitializes the SDK.environment, merchantPublicKeyvoid
buildCardPaymentIntentCreates an intent for payment.context, orderId, configurationIntent
mapIntentToResultMaps the result code and intent data to a Result object. It's recommended to be used to map the result passed in onActivityResult() once the payment is completed.resultCode, resultIntentResult

RevolutPaymentApi.init method

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

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

Possible values:
  • PRODUCTION
  • SANDBOX
EnumYes
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

RevolutPaymentApi.buildCardPaymentIntent method

The buildCardPaymentIntent method constructs an Intent that launches the card payment process. It uses the provided context, order ID, and configuration details to initiate a secure payment activity.

fun buildCardPaymentIntent(
context: Context,
orderId: String,
configuration: Configuration.CardPayment,
)
ParameterDescriptionFormatRequired
contextThe context in which the payment activity is launched. This is typically the current activity that initiates the payment process.ContextYes
orderIdThe unique token of the order, obtained from your server after creating an order. This identifies the transaction to be processed.StringYes
configurationA configuration object that specifies payment details such as email, billing, and shipping addresses.Configuration.CardPaymentYes

RevolutPaymentApi.mapIntentToResult method

The mapIntentToResult method is used to interpret the result of a payment activity. It maps the result code and intent data returned by the payment activity into a more usable form for further processing.

fun mapIntentToResult(
resultCode: Int,
resultIntent: Intent?
)
ParameterDescriptionFormatRequired
resultCodeThe integer result code returned by the payment process.IntYes
resultIntentAn Intent, which can carry result data to the parent activity (e.g., payment details).IntentYes

Configuration.CardPayment class

class Configuration.CardPayment(
email: String?,
billingAddress: AddressParams?,
shippingAddress: AddressParams?,
savePaymentMethodFor: UserType?
)
ParameterDescriptionFormatRequired
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:
  • CUSTOMER - This method is used only when the customer is on the checkout page.
  • 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

Results

The Result class is a sealed class that represents the outcome of a payment operation. It is designed to encapsulate both successful results and various error conditions, allowing developers to handle different scenarios effectively.

ApiError class

The ApiError class represents errors returned by the API with specific error codes and identifiers. This helps in diagnosing issues related to API requests and responses.

note

The result codes between 1000 and 1009 (included) are used by the SDK, avoid using them to prevent any collisions.

class ApiError(
verrorCode: Int,
errorId: String
)
ParameterDescriptionFormatRequired
errorCodeThe numerical code indicating the type of API error encountered.IntYes
errorIdA string identifier for the specific API error, useful for tracking and debugging.Yes

NetworkError class

The NetworkError class captures issues related to network connectivity and communication, providing an error code and descriptive message.

class NetworkError(
errorCode: Int,
message: String
)
ParameterDescriptionFormatRequired
errorCodeThe numerical code indicating the type of network error encountered.IntYes
messageA descriptive message providing more details about the network error.StringYes

GenericError class

The GenericError class handles general errors that may occur, offering optional details like a message and stack trace for better debugging.

class GenericError(
message: String?,
stackTrace: String?
)
ParameterDescriptionFormatRequired
messageAn optional message detailing the error.StringNo
errorCodeAn optional stack trace for diagnosing the source of the error.StringNo

OrderNotAvailable object

The OrderNotAvailable object represents a specific error state where the requested order is not currently available for processing. This error indicates that the order cannot be processed due to its current status or availability issues.

OrderNotFound object

The OrderNotFound object signifies an error where the specified order could not be located in the system. This error suggests that the provided order token is invalid or the order no longer exists.

TimeoutError object

The TimeoutError object denotes an error condition where a request or operation has exceeded the allowed time limit. This error occurs when a process takes too long to complete, likely due to network delays or server responsiveness issues.

Authorised object

The Authorised object indicates a successful authorisation of a payment, confirming that the transaction can proceed.

Failed class

The Failed class represents a payment failure, providing a reason for the failure through the FailureReason type.

class Failed(
failureReason: FailureReason
)
ParameterDescriptionFormatRequired
failureReasonThe specific reason for the payment failure, detailing why the transaction could not be completed.FailureReasonYes
info

For more information about the returned values, see: Decline reasons.

Declined class

The Declined class captures situations where a payment is declined, specifying the reason for the decline with the DeclineReason type.

class Declined(
declineReason: DeclineReason
)
ParameterDescriptionFormatRequired
declineReasonThe specific reason provided for declining the payment, such as insufficient funds or fraud suspicion.DeclineReasonYes
info

For more information about the returned values, see: Decline reasons.

InputValidationError enum

The InputValidationError enum defines types of errors related to invalid input data during payment processing.

enum InputValidationError {
INVALID_CARD_NUMBER,
INVALID_CVV,
INVALID_EXPIRY,
INVALID_EMAIL,
INVALID_CARDHOLDER_NAME
}
info

For more information about the returned values, see: Decline reasons.

Was this page helpful?