Merchant iOS SDKs
Methods and parameters
doc

Revolut Pay iOS SDK

This document provides a detailed reference for the parameters, objects, and methods available in the Revolut Pay iOS SDK.

info

For detailed instructions on how to install and integrate the SDK, see: Accept payments via Revolut Pay - 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
)
)
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

RevolutPayKit.button method

This method creates a RevolutPayButton, a UIView that handles the entire Revolut Pay flow when tapped. It is the primary way to initiate a payment. The method can be configured for one of three payment flows:

  1. Standard payment: No optional features are enabled.
  2. Fast checkout: Set shouldRequestShipping to true to collect shipping information.
  3. Merchant-Initiated Transaction (MIT): Set savePaymentMethodForMerchant to true to save the customer's payment details for future use.
note

Fast checkout and MIT are mutually exclusive. You can enable one or the other, but not both in the same transaction.

func button(
style: RevolutPayButton.Style,
returnURL: String,
savePaymentMethodForMerchant: Bool, // or shouldRequestShipping: Bool,
customer: Customer? = nil,
createOrder: @escaping CreateOrderCallback,
completion: @escaping (RevolutPayKit.PaymentResult) -> Void
) -> RevolutPayButton
ParameterDescriptionFormatRequired
styleContains styling parameters of the button.RevolutPayButton.StyleYes
returnURLUpon payment completion, the Revolut app attempts to open this URL. This can be a Universal Link or a custom URL scheme.

Possible values:
StringYes
savePaymentMethodForMerchantIf true, the customer gives permission for their payment method to be saved for future merchant-initiated transactions. Default is false.

To learn more about merchant initiated transactions, see: Accept payments via Revolut Pay - iOS: Advanced features.
BooleanNo
shouldRequestShippingIf true, the shipping address and delivery method are collected from the user via the Revolut Pay flow. Requires backend support for Fast checkout. Default is false.

To learn more about Fast checkout, see: Accept payments via Revolut Pay - iOS: Advanced features.
BooleanNo
customerAn object containing customer details you already have, which will be pre-filled during widget initialisation.CustomerNo
createOrderA callback function that is executed after the user taps the button. Your app should request an order token from your backend and pass it to the createOrderHandler.ClosureYes
completionA closure that is called when the payment flow is complete. It returns a PaymentResult indicating success, failure, or user abandonment.

Possible values
  • .success - The payment was successful.
  • .failure - An error occurred during the payment.
  • .userAbandonedPayment - The customer abandoned the payment flow.

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

RevolutPayKit.swiftUIButton method

This method creates a SwiftUI-native Revolut Pay button that functions identically to the UIKit version.

@ViewBuilder func swiftUIButton(
style: RevolutPayButton.Style,
returnURL: String,
savePaymentMethodForMerchant: Bool, // or shouldRequestShipping: Bool,
customer: Customer? = nil,
createOrder: @escaping CreateOrderCallback,
completion: @escaping (RevolutPayKit.PaymentResult) -> Void
) -> some View
ParameterDescriptionFormatRequired
styleContains styling parameters of the button.RevolutPayButton.StyleYes
returnURLUpon payment completion, the Revolut app attempts to open this URL. This can be a Universal Link or a custom URL scheme.

Possible values:
StringYes
savePaymentMethodForMerchantIf true, the customer gives permission for their payment method to be saved for future merchant-initiated transactions. Default is false.

To learn more about merchant initiated transactions, see: Accept payments via Revolut Pay - iOS: Advanced features.
BooleanNo
shouldRequestShippingIf true, the shipping address and delivery method are collected from the user via the Revolut Pay flow. Requires backend support for Fast checkout. Default is false.

To learn more about Fast checkout, see: Accept payments via Revolut Pay - iOS: Advanced features.
BooleanNo
customerAn object containing customer details you already have, which will be pre-filled during widget initialisation.CustomerNo
createOrderA callback function that is executed after the user taps the button. Your app should request an order token from your backend and pass it to the createOrderHandler.ClosureYes
completionA closure that is called when the payment flow is complete. It returns a PaymentResult indicating success, failure, or user abandonment.

Possible values
  • .success - The payment was successful.
  • .failure - An error occurred during the payment.
  • .userAbandonedPayment - The customer abandoned the payment flow.

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

RevolutPayKit.pay method

This method allows you to initiate the Revolut Pay flow programmatically without requiring the user to tap a RevolutPayButton.

func pay(
orderToken: String,
returnURL: String,
savePaymentMethodForMerchant: Bool, // or shouldRequestShipping: Bool,
customer: Customer? = nil,
completion: @escaping (RevolutPayKit.PaymentResult) -> Void
)
ParameterDescriptionFormatRequired
orderTokenThe token for the order created via the Merchant API, passed to the SDK from your backend.StringYes
returnURLUpon payment completion, the Revolut app attempts to open this URL. This can be a Universal Link or a custom URL scheme.

Possible values:
StringYes
savePaymentMethodForMerchantIf true, the customer gives permission for their payment method to be saved for future merchant-initiated transactions. Default is false.

To learn more about merchant initiated transactions, see: Accept payments via Revolut Pay - iOS: Advanced features.
BooleanNo
shouldRequestShippingIf true, the shipping address and delivery method are collected from the user via the Revolut Pay flow. Requires backend support for Fast checkout. Default is false.

To learn more about Fast checkout, see: Accept payments via Revolut Pay - iOS: Advanced features.
BooleanNo
customerAn object containing customer details you already have, which will be pre-filled during widget initialisation.CustomerNo
completionA closure that is called when the payment flow is complete. It returns a PaymentResult indicating success, failure, or user abandonment.ClosureYes

RevolutPayKit.promotionalBanner method

This method creates a UIView that displays a promotional banner inviting users to join Revolut.

func promotionalBanner(
style: PromotionalBannerStyle = .init(),
transactionId: String,
amount: Int64?,
currency: Currency,
customer: PromotionalBannerCustomer?
) -> UIView
ParameterDescriptionFormatRequired
styleContains styling parameters for the banner.PromotionalBannerStyleNo
transactionIdThe ID of the transaction corresponding to the promotional offer.StringYes
amountThe amount paid by the customer, in the currency's smallest unit (e.g., 1000 for £10.00).Int64No
currencyThe payment currency in ISO 4217 format.

Possible Values
  • .AED
  • .AUD
  • .BGN
  • .CAD
  • .CHF
  • .CZK
  • .DKK
  • .EUR
  • .GBP
  • .HKD
  • .HRK
  • .HUF
  • .ILS
  • .JPY
  • .MXN
  • .NOK
  • .NZD
  • .PLN
  • .QAR
  • .RON
  • .RUB
  • .SAR
  • .SEK
  • .SGD
  • .THB
  • .TRY
  • .USD
  • .ZAR
CurrencyYes
customerAn object containing customer details to pre-fill the offer.PromotionalBannerCustomerNo

Helper objects and types

Customer object

This object holds the customer's information. To create a Customer object, use its initialser:

public init(
name: String? = nil,
dateOfBirth: GenericDate? = nil,
email: String? = nil,
phone: String? = nil,
countryCode: String? = nil
)
ParameterDescriptionFormatRequired
nameCustomer's full name.StringNo
dateOfBirthCustomer's date of birth.GenericDateNo
emailCustomer's email address.StringNo
phoneCustomer's phone number, including the + sign and country code.StringNo
countryCodeCustomer's country in ISO 3166-1 alpha-2 format (e.g., "GB").StringNo

GenericDate object

This object represents a simple Gregorian calendar date. To create a GenericDate object, use its failable initialiser:

public init?(
day: UInt,
month: UInt,
year: UInt
)
ParameterDescriptionFormatRequired
dayDay of the date. Must be between 1 and 31.UIntYes
monthMonth of the date. Must be between 1 and 12.UIntYes
yearYear of the date. Must have four digits (e.g. 1970).UIntYes

RevolutPayButton.Style object

This object defines the visual style of the RevolutPayButton. To create a Style object, use its initializer:

public init(
size: Size = .large,
variants: VariantModes = .init(),
radius: Radius = .small,
attachmentStyle: AttachmentStyle? = .init()
)
ParameterDescriptionFormatRequired
sizeThe size of the button. Default is .large.SizeNo
variantsThe color schemes for light and dark modes.VariantModesNo
radiusThe corner radius of the button. Default is .small.RadiusNo
attachmentStyleThe style of the optional attachment box, used to attract users.AttachmentStyleNo

RevolutPayButton.Style.Size

An enum that defines the size of the button, which affects its intrinsic content size.

public enum Size {
case large
case medium
case small
case extraSmall
}

RevolutPayButton.Style.VariantModes

A struct that defines the button's appearance for light and dark modes. To create a VariantModes object, use its initialiser:

public init(
lightMode: Style.Variant = .dark,
darkMode: Style.Variant = .light
)
ParameterDescriptionFormatRequired
lightModeThe variant to use for light mode.VariantNo
darkModeThe variant to use for dark mode.VariantNo

RevolutPayButton.Style.Variant

An enum that defines the colour scheme of the button.

public enum Variant {
case light
case dark
case lightOutlined
case darkOutlined
}
CaseDescription
lightLight background. Should be used on dark screen backgrounds.
darkDark background. Should be used on light screen backgrounds.
lightOutlinedLight background with a dark outline.
darkOutlinedDark background with a light outline.
info

For more information about colour scheme recommendations see: Revolut Pay button guidelines

RevolutPayButton.Style.Radius

An enum that defines the corner radius of the button.

public enum Radius {
case none
case small
case medium
case large
@available(*, deprecated, renamed: "large")
case rounded
}
info

For more information about button style recommendations see: Revolut Pay button guidelines

RevolutPayButton.Style.AttachmentStyle

A struct that defines the style for the optional attachment box displayed below the button.

public struct AttachmentStyle {
let currency: Currency
}
ParameterDescriptionFormatRequired
currencyThe currency displayed in the reward text in ISO 4217 format.CurrencyYes

PromotionalBannerStyle object

This object defines the visual style of the promotional banner. To create a PromotionalBannerStyle object, use its initialiser:

public init(
accentColor: UIColor? = nil,
backgroundColor: UIColor? = nil,
bannerCornerRadius: CGFloat = 16,
componentCornerRadius: CornerRadius = .default,
border: Border? = nil
)
ParameterDescriptionFormatRequired
accentColorThe banner's accent color. Other colors are derived from this.UIColorNo
backgroundColorThe banner's background color.UIColorNo
bannerCornerRadiusThe corner radius of the banner's view.CGFloatNo
componentCornerRadiusThe corner radius of the banner's components.CornerRadiusNo
borderThe banner's border configuration.BorderNo

PromotionalBannerStyle.Border object

This object defines the style for the promotional banner's border. To create a Border object, use its initialiser:

public init(
color: UIColor? = nil,
width: CGFloat = 1
)
ParameterDescriptionFormatRequired
colorThe color of the banner's border.UIColorNo
widthThe width of the banner's border.CGFloatNo

PromotionalBannerStyle.CornerRadius enumeration

This enum defines the corner radius style for components within the promotional banner.

public enum CornerRadius {
case custom(CGFloat)
case circular
case `default`
}
CaseDescription
custom(CGFloat)A custom corner radius with a specific CGFloat value.
circularA fully rounded corner radius, creating a circular shape.
defaultThe default corner radius style provided by the SDK.

PromotionalBannerCustomer object

This object holds the customer's information for the promotional banner. To create a PromotionalBannerCustomer object, use its initialiser:

public init(
name: String? = nil,
email: String? = nil,
phone: String? = nil,
country: Country? = nil
)
ParameterDescriptionFormatRequired
nameCustomer's full name.StringNo
emailCustomer's email address.StringNo
phoneCustomer's phone number, including the + sign and country code.StringNo
countryCustomer's country.CountryNo

Currency enumeration

This enum represents currency in ISO 4217 format. Use dot notation (e.g., .GBP) to select a value.

public enum Currency: String {
case AED
case AUD
case BGN
case CAD
case CHF
case CZK
case DKK
case EUR
case GBP
case HKD
case HRK
case HUF
case ILS
case JPY
case MXN
case NOK
case NZD
case PLN
case QAR
case RON
case RUB
case SAR
case SEK
case SGD
case THB
case TRY
case USD
case ZAR
}

Country enumeration

This enum maps ISO 3166-1 alpha-2 country codes to human-readable format. Use dot notation (e.g., .unitedKingdom) to select a value.

public enum Country: String {
case austria = "AT"
case belgium = "BE"
case bulgaria = "BG"
case croatia = "HR"
case cyprus = "CY"
case czechRepublic = "CZ"
case denmark = "DK"
case estonia = "EE"
case finland = "FI"
case france = "FR"
case germany = "DE"
case greece = "GR"
case hungary = "HU"
case iceland = "IS"
case ireland = "IE"
case italy = "IT"
case latvia = "LV"
case liechtenstein = "LI"
case lithuania = "LT"
case luxembourg = "LU"
case malta = "MT"
case monaco = "MO"
case netherlands = "NL"
case norway = "NO"
case poland = "PL"
case portugal = "PT"
case romania = "RO"
case spain = "ES"
case slovenia = "SI"
case slovakia = "SK"
case sweden = "SE"
case switzerland = "CH"
case ukraine = "UA"
case unitedKingdom = "GB"
case vaticanCity = "VA"
case canada = "CA"
case mexico = "MX"
case usa = "US"
case brazil = "BR"
case hongKong = "HK"
case india = "IN"
case japan = "JP"
case kazakhstan = "KZ"
case macau = "MC"
case singapore = "SG"
case australia = "AU"
case newZealand = "NZ"
}

Callbacks and results

RevolutPayKit.PaymentResult enumeration

This enum represents the final outcome of a payment flow and is returned in the completion closure.

CaseDescription
.successThe payment was successful.
.failure(Error)The payment failed with an associated RevolutPayKit.Error.
.userAbandonedPaymentThe user dismissed or abandoned the payment flow.

RevolutPayKit.CreateOrderHandler class

This handler is provided in the createOrder callback and is used to pass the order token back to the SDK.

MethodDescription
set(orderToken: String)Sets the order token obtained from your backend to proceed with the payment.
cancel()Stops the payment flow.

Errors

RevolutPayKit.Error enumeration

This enum defines the possible errors that can be returned in the .failure case of a PaymentResult.

public enum Error: Swift.Error {
case sdkNotConfigured
case kitAlreadyInUse
case paymentFailed
case cantBuildRevolutUniversalLink(token: String, returnURL: String)
case cantAuthenticate
case apiError(Swift.Error?)
case internalError
}
CaseDescription
sdkNotConfiguredThe SDK was not configured before use. Ensure RevolutPaymentsSDK.configure(with:) has been called.
kitAlreadyInUseThe RevolutPayKit instance is already processing another payment.
paymentFailedThe payment failed for reasons like insufficient funds.
cantBuildRevolutUniversalLinkThe SDK could not construct the necessary URL for redirection, possibly due to an invalid token or return URL.
cantAuthenticateThe user could not be authenticated.
apiErrorAn internal API error occurred, such as using a token for an already paid order.
internalErrorAn unspecified internal error occurred.
Was this page helpful?