Merchant iOS SDKs
Methods and parameters
doc

Revolut Merchant Card Form SDK

This page contains information about the available methods and parameters of the Revolut Merchant Card Form SDK for iOS.

info

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

Methods and parameters

RevolutPaymentsSDK.configure method

The 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
)
)
ParameterDescriptionFormatRequired
merchantPublicKeyThe merchant's public API key used for authorization.StringYes
environmentThis parameter specifies the environment in which the SDK operates. If omitted it defaults to .production.

Possible values are:
  • .production
  • .sandbox
EnvironmentYes

RevolutMerchantCardFormKit.pay method

The 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
)
ParameterDescriptionFormatRequired
publicIdThe unique token of the order, obtained from your server after creating an order. This identifies the transaction to be processed.StringYes
billingAddressAn optional parameter that accepts an object of type RevolutMerchantCardFormKit.Address, representing the customer's billing address. Providing this can help increase payment acceptance rates.AddressNo
shippingAddressAn optional parameter that accepts an object of type RevolutMerchantCardFormKit.Address, representing the customer's shipping address.AddressNo
emailThe customer's email address, which can be used for sending payment confirmations and receipts.StringNo
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
completionThe 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:
  • .success - The payment was successful.
  • .failure - An error occurred during the payment.

Further considerations

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

RevolutMerchantCardFormKit.Address object

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

Errors

RevolutMerchantCardFormKit.PaymentError enumeration

The 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>)
)
CaseDescription
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.
orderNotFoundThe 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.
orderNotAvailableThe order is currently not available for processing, possibly due to changes in its status or other restrictions.
internalErrorAn unspecified internal error occurred within the SDK or payment system. This might require further investigation if encountered frequently.
timeoutThe 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 enumeration

The 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
)
info

For more information about the error cases, see: Decline reasons.

RevolutMerchantCardFormKit.PaymentError.InputValidationError enumeration

The 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
)
info

For more information about the error cases, see: Decline reasons.

Was this page helpful?