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.
The following methods are available on the RevolutPaymentApi
class:
Method | Description | Parameters | Return type | Exceptions |
---|---|---|---|---|
init | Initializes the SDK. | environment , merchantPublicKey | void | |
buildCardPaymentIntent | Creates an intent for payment. | context , orderId , configuration | Intent | |
mapIntentToResult | Maps 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 , resultIntent | Result |
RevolutPaymentApi.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.
fun init(
environment: Environment,
merchantPublicKey: String
)
Parameter | Description | Format | Required |
---|---|---|---|
environment | This parameter specifies the environment in which the SDK operates. Default value: PRODUCTION Possible values:
| Enum | Yes |
merchantPublicKey | The merchant's public API key used for authorisation, obtained from the Merchant API settings page. For the Sandbox environment use the Sandbox API Public key. | String | Yes |
RevolutPaymentApi.buildCardPaymentIntent
methodThe 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,
)
Parameter | Description | Format | Required |
---|---|---|---|
context | The context in which the payment activity is launched. This is typically the current activity that initiates the payment process. | Context | Yes |
orderId | The unique token of the order, obtained from your server after creating an order. This identifies the transaction to be processed. | String | Yes |
configuration | A configuration object that specifies payment details such as email, billing, and shipping addresses. | Configuration.CardPayment | Yes |
RevolutPaymentApi.mapIntentToResult
methodThe 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?
)
Parameter | Description | Format | Required |
---|---|---|---|
resultCode | The integer result code returned by the payment process. | Int | Yes |
resultIntent | An Intent , which can carry result data to the parent activity (e.g., payment details). | Intent | Yes |
Configuration.CardPayment
classclass Configuration.CardPayment(
email: String?,
billingAddress: AddressParams?,
shippingAddress: AddressParams?,
savePaymentMethodFor: UserType?
)
Parameter | Description | Format | Required |
---|---|---|---|
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:
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 |
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
classThe 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.
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
)
Parameter | Description | Format | Required |
---|---|---|---|
errorCode | The numerical code indicating the type of API error encountered. | Int | Yes |
errorId | A string identifier for the specific API error, useful for tracking and debugging. | Yes |
NetworkError
classThe NetworkError
class captures issues related to network connectivity and communication, providing an error code and descriptive message.
class NetworkError(
errorCode: Int,
message: String
)
Parameter | Description | Format | Required |
---|---|---|---|
errorCode | The numerical code indicating the type of network error encountered. | Int | Yes |
message | A descriptive message providing more details about the network error. | String | Yes |
GenericError
classThe 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?
)
Parameter | Description | Format | Required |
---|---|---|---|
message | An optional message detailing the error. | String | No |
errorCode | An optional stack trace for diagnosing the source of the error. | String | No |
OrderNotAvailable
objectThe 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
objectThe 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
objectThe 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
objectThe Authorised
object indicates a successful authorisation of a payment, confirming that the transaction can proceed.
Failed
classThe Failed
class represents a payment failure, providing a reason for the failure through the FailureReason
type.
class Failed(
failureReason: FailureReason
)
Parameter | Description | Format | Required |
---|---|---|---|
failureReason | The specific reason for the payment failure, detailing why the transaction could not be completed. | FailureReason | Yes |
For more information about the returned values, see: Decline reasons.
Declined
classThe Declined
class captures situations where a payment is declined, specifying the reason for the decline with the DeclineReason
type.
class Declined(
declineReason: DeclineReason
)
Parameter | Description | Format | Required |
---|---|---|---|
declineReason | The specific reason provided for declining the payment, such as insufficient funds or fraud suspicion. | DeclineReason | Yes |
For more information about the returned values, see: Decline reasons.
InputValidationError
enumThe 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
}
For more information about the returned values, see: Decline reasons.