This document provides a detailed reference for the parameters, objects, and methods available in the Revolut Pay iOS SDK.
For detailed instructions on how to install and integrate the SDK, see: Accept payments via Revolut Pay - 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
)
)
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 |
RevolutPayKit.button
methodThis 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:
shouldRequestShipping
to true
to collect shipping information.savePaymentMethodForMerchant
to true
to save the customer's payment details for future use.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
Parameter | Description | Format | Required |
---|---|---|---|
style | Contains styling parameters of the button. | RevolutPayButton.Style | Yes |
returnURL | Upon payment completion, the Revolut app attempts to open this URL. This can be a Universal Link or a custom URL scheme. Possible values:
| String | Yes |
savePaymentMethodForMerchant | If 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. | Boolean | No |
shouldRequestShipping | If 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. | Boolean | No |
customer | An object containing customer details you already have, which will be pre-filled during widget initialisation. | Customer | No |
createOrder | A 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 . | Closure | Yes |
completion | A closure that is called when the payment flow is complete. It returns a PaymentResult indicating success, failure, or user abandonment.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 |
RevolutPayKit.swiftUIButton
methodThis 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
Parameter | Description | Format | Required |
---|---|---|---|
style | Contains styling parameters of the button. | RevolutPayButton.Style | Yes |
returnURL | Upon payment completion, the Revolut app attempts to open this URL. This can be a Universal Link or a custom URL scheme. Possible values:
| String | Yes |
savePaymentMethodForMerchant | If 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. | Boolean | No |
shouldRequestShipping | If 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. | Boolean | No |
customer | An object containing customer details you already have, which will be pre-filled during widget initialisation. | Customer | No |
createOrder | A 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 . | Closure | Yes |
completion | A closure that is called when the payment flow is complete. It returns a PaymentResult indicating success, failure, or user abandonment.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 |
RevolutPayKit.pay
methodThis 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
)
Parameter | Description | Format | Required |
---|---|---|---|
orderToken | The token for the order created via the Merchant API, passed to the SDK from your backend. | String | Yes |
returnURL | Upon payment completion, the Revolut app attempts to open this URL. This can be a Universal Link or a custom URL scheme. Possible values:
| String | Yes |
savePaymentMethodForMerchant | If 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. | Boolean | No |
shouldRequestShipping | If 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. | Boolean | No |
customer | An object containing customer details you already have, which will be pre-filled during widget initialisation. | Customer | No |
completion | A closure that is called when the payment flow is complete. It returns a PaymentResult indicating success, failure, or user abandonment. | Closure | Yes |
RevolutPayKit.promotionalBanner
methodThis 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
Parameter | Description | Format | Required |
---|---|---|---|
style | Contains styling parameters for the banner. | PromotionalBannerStyle | No |
transactionId | The ID of the transaction corresponding to the promotional offer. | String | Yes |
amount | The amount paid by the customer, in the currency's smallest unit (e.g., 1000 for £10.00). | Int64 | No |
currency | The payment currency in ISO 4217 format. Possible Values
| Currency | Yes |
customer | An object containing customer details to pre-fill the offer. | PromotionalBannerCustomer | No |
Customer
objectThis 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
)
Parameter | Description | Format | Required |
---|---|---|---|
name | Customer's full name. | String | No |
dateOfBirth | Customer's date of birth. | GenericDate | No |
email | Customer's email address. | String | No |
phone | Customer's phone number, including the + sign and country code. | String | No |
countryCode | Customer's country in ISO 3166-1 alpha-2 format (e.g., "GB"). | String | No |
GenericDate
objectThis object represents a simple Gregorian calendar date. To create a GenericDate
object, use its failable initialiser:
public init?(
day: UInt,
month: UInt,
year: UInt
)
Parameter | Description | Format | Required |
---|---|---|---|
day | Day of the date. Must be between 1 and 31. | UInt | Yes |
month | Month of the date. Must be between 1 and 12. | UInt | Yes |
year | Year of the date. Must have four digits (e.g. 1970). | UInt | Yes |
RevolutPayButton.Style
objectThis 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()
)
Parameter | Description | Format | Required |
---|---|---|---|
size | The size of the button. Default is .large . | Size | No |
variants | The color schemes for light and dark modes. | VariantModes | No |
radius | The corner radius of the button. Default is .small . | Radius | No |
attachmentStyle | The style of the optional attachment box, used to attract users. | AttachmentStyle | No |
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
)
Parameter | Description | Format | Required |
---|---|---|---|
lightMode | The variant to use for light mode. | Variant | No |
darkMode | The variant to use for dark mode. | Variant | No |
RevolutPayButton.Style.Variant
An enum that defines the colour scheme of the button.
public enum Variant {
case light
case dark
case lightOutlined
case darkOutlined
}
Case | Description |
---|---|
light | Light background. Should be used on dark screen backgrounds. |
dark | Dark background. Should be used on light screen backgrounds. |
lightOutlined | Light background with a dark outline. |
darkOutlined | Dark background with a light outline. |
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
}
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
}
Parameter | Description | Format | Required |
---|---|---|---|
currency | The currency displayed in the reward text in ISO 4217 format. | Currency | Yes |
PromotionalBannerStyle
objectThis 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
)
Parameter | Description | Format | Required |
---|---|---|---|
accentColor | The banner's accent color. Other colors are derived from this. | UIColor | No |
backgroundColor | The banner's background color. | UIColor | No |
bannerCornerRadius | The corner radius of the banner's view. | CGFloat | No |
componentCornerRadius | The corner radius of the banner's components. | CornerRadius | No |
border | The banner's border configuration. | Border | No |
PromotionalBannerStyle.Border
objectThis 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
)
Parameter | Description | Format | Required |
---|---|---|---|
color | The color of the banner's border. | UIColor | No |
width | The width of the banner's border. | CGFloat | No |
PromotionalBannerStyle.CornerRadius
enumerationThis enum defines the corner radius style for components within the promotional banner.
public enum CornerRadius {
case custom(CGFloat)
case circular
case `default`
}
Case | Description |
---|---|
custom(CGFloat) | A custom corner radius with a specific CGFloat value. |
circular | A fully rounded corner radius, creating a circular shape. |
default | The default corner radius style provided by the SDK. |
PromotionalBannerCustomer
objectThis 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
)
Parameter | Description | Format | Required |
---|---|---|---|
name | Customer's full name. | String | No |
email | Customer's email address. | String | No |
phone | Customer's phone number, including the + sign and country code. | String | No |
country | Customer's country. | Country | No |
Currency
enumerationThis 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
enumerationThis 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"
}
RevolutPayKit.PaymentResult
enumerationThis enum represents the final outcome of a payment flow and is returned in the completion
closure.
Case | Description |
---|---|
.success | The payment was successful. |
.failure(Error) | The payment failed with an associated RevolutPayKit.Error . |
.userAbandonedPayment | The user dismissed or abandoned the payment flow. |
RevolutPayKit.CreateOrderHandler
classThis handler is provided in the createOrder
callback and is used to pass the order token
back to the SDK.
Method | Description |
---|---|
set(orderToken: String) | Sets the order token obtained from your backend to proceed with the payment. |
cancel() | Stops the payment flow. |
RevolutPayKit.Error
enumerationThis 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
}
Case | Description |
---|---|
sdkNotConfigured | The SDK was not configured before use. Ensure RevolutPaymentsSDK.configure(with:) has been called. |
kitAlreadyInUse | The RevolutPayKit instance is already processing another payment. |
paymentFailed | The payment failed for reasons like insufficient funds. |
cantBuildRevolutUniversalLink | The SDK could not construct the necessary URL for redirection, possibly due to an invalid token or return URL. |
cantAuthenticate | The user could not be authenticated. |
apiError | An internal API error occurred, such as using a token for an already paid order. |
internalError | An unspecified internal error occurred. |