This page contains information about the available methods and parameters of the Revolut Merchant Card Form SDK for iOS.
For detailed instructions on how to install and integrate the SDK, see: Accept payments via Revolut Merchant Card Form SDK - iOS.
RevolutPaymentsSDK.configure
methodThe RevolutPaymentsSDK.configure
method is used to set up the SDK with necessary configurations, such as the merchant's public API key and the environment in which the SDK will operate. Configuring the SDK needs to happen before any SDK usage, can be done on app launch by adding this to AppDelegate
.
RevolutPaymentsSDK.configure(
with: .init(
merchantPublicKey: String,
environment: Environment = .production
)
)
Parameter | Description | Format | Required |
---|---|---|---|
merchantPublicKey | The merchant's public API key used for authorization. | String | Yes |
environment | This parameter specifies the environment in which the SDK operates. If omitted it defaults to .production . Possible values are:
| Environment | Yes |
RevolutMerchantCardFormKit.pay
methodThe RevolutMerchantCardFormKit.pay
method initiates the payment process by presenting a card payment form to the user. It manages the collection of payment details and handles the payment transaction. This method is critical for processing card payments within your app.
RevolutMerchantCardFormKit.pay(
publicId: String,
billingAddress: Address? = nil,
shippingAddress: Address? = nil,
email: String? = nil,
savePaymentMethodFor: UserType? = nil,
completion: @escaping (Result<Void, PaymentError>) -> Void
)
Parameter | Description | Format | Required |
---|---|---|---|
publicId | The unique token of the order, obtained from your server after creating an order. This identifies the transaction to be processed. | String | Yes |
billingAddress | An optional parameter that accepts an object of type RevolutMerchantCardFormKit.Address , representing the customer's billing address. Providing this can help increase payment acceptance rates. | Address | No |
shippingAddress | An optional parameter that accepts an object of type RevolutMerchantCardFormKit.Address , representing the customer's shipping address. | Address | No |
email | The customer's email address, which can be used for sending payment confirmations and receipts. | String | 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 |
completion | The completion closure acts as a callback to manage the outcomes of payment operations initiated by the RevolutMerchantCardFormKit . The closure is called once the payment process is concluded, covering scenarios of success, failure. Possible values:
Further considerationsThe completion closure might indicate a failure even if the user later completes the payment, such as in scenarios where they initially abandon the payment or if there is a transient issue during payment processing. Therefore, it is crucial to verify the final payment status with your backend before concluding that the payment has failed permanently. This helps in avoiding scenarios where a transaction might be unintentionally processed more than once. | Closure | Yes |
RevolutMerchantCardFormKit.Address
objectThe RevolutMerchantCardFormKit.Address
object 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.
RevolutMerchantCardFormKit.Address(
country: String,
region: String? = nil,
city: String? = nil,
streetLine1: String? = nil,
streetLine2: String? = nil,
postcode: String? = nil
)
Parameter | Description | Format | Required |
---|---|---|---|
country | The 2-letter country code of the country associated with the address. | String | Yes |
region | The region or state within the country. | String | No |
city | The city or locality of the address. | String | No |
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 |
postcode | The postcode of the address. | String | No |
RevolutMerchantCardFormKit.PaymentError
enumerationThe PaymentError
enumeration defines a set of error types that can occur during the payment process, returned by the .failure
case of the completion
closure. These errors provide detailed information about what went wrong, and help developers handle various failure scenarios appropriately. The PaymentError
enum conforms to the Error
and Equatable
protocols, allowing it to be used in error handling and comparison operations.
RevolutMerchantCardFormKit.PaymentError(
case failed(FailureReasonError),
case declined(FailureReasonError),
case orderNotFound,
case orderNotAvailable,
case internalError,
case timeout,
case invalidInput(Set<InputValidationError>)
)
Case | Description |
---|---|
failed(FailureReasonError) | Indicates that the payment process failed due to a specific reason encapsulated in FailureReasonError . This is a catch-all for errors that do not fit into more specific categories. |
declined(FailureReasonError) | The payment was declined by the issuer or payment gateway, with a reason provided by FailureReasonError . This typically occurs due to issues identified by the payment processor. |
orderNotFound | The specified order could not be found. This error usually occurs when an invalid or expired order token is provided. Ensure that the correct order token is being used. |
orderNotAvailable | The order is currently not available for processing, possibly due to changes in its status or other restrictions. |
internalError | An unspecified internal error occurred within the SDK or payment system. This might require further investigation if encountered frequently. |
timeout | The payment process timed out, typically due to network issues or unresponsive services. Retrying the operation or checking the network connection might resolve this issue. |
invalidInput(Set<InputValidationError>) | One or more input parameters are invalid, as described by a set of InputValidationError values. This requires validation and correction of the input data before retrying the payment process. |
RevolutMerchantCardFormKit.PaymentError.FailureReasonError
enumerationThe FailureReasonError
enumeration provides specific reasons for failed or declined payments. It offers detailed insights into why a payment might have been declined or failed, allowing developers to implement precise error handling and inform users accordingly. This enum conforms to the Error
and Equatable
protocols, enabling effective error management and comparison.
RevolutMerchantCardFormKit.PaymentError.FailureReasonError(
case highRisk
case unknownCard
case pickupCard
case invalidCard
case expiredCard
case doNotHonour
case invalidEmail
case invalidAmount
case restrictedCard
case insufficientFunds
case rejectedByCustomer
case cardholderNameMissing
case withdrawalLimitExceeded
case threeDSChallengeFailed
case threeDSChallengeAbandoned
case threeDSChallengeFailedManually
case transactionNotAllowedForCardholder
case issuerNotAvailable
case invalidExpiry
case invalidCVV
case invalidPin
case invalidPhone
case invalidAddress
case invalidCountry
case invalidMerchant
case customerChallengeFailed
case customerNameMismatch
case technicalError
case unknown
)
For more information about the error cases, see: Decline reasons.
RevolutMerchantCardFormKit.PaymentError.InputValidationError
enumerationThe InputValidationError
enumeration specifies the types of input errors that can occur when validating payment information. These errors help developers identify specific issues with user input and provide feedback or corrective actions to ensure data integrity and successful transaction processing. The enum conforms to the Error
and Equatable
protocols, making it suitable for error handling and comparisons.
RevolutMerchantCardFormKit.PaymentError.InputValidationError(
case invalidCardholderName
case invalidExpirationDate
case invalidCardNumber
case invalidCVV
case invalidEmail
)
For more information about the error cases, see: Decline reasons.