This page contains information about the available parameters for the Revolut Pay iOS SDK. For detailed instructions on how to install the SDK, see: Accept payments via Revolut Pay - iOS
Provide configuration information, such as, your Merchant API Public key and the environment. This step should be done on app launch, in AppDelegate
.
You need to first generate the Merchant API key. To do this, you have to be accepted as a Merchant in your Revolut Business account. The iOS SDK requires the public merchant key.
Create a RevolutPayKit
object. It provides all the necessary tools for processing the payment of a specific item or list of items (for example, the items on your Checkout screen).
Create a Revolut Pay button, call the button
or swiftUIButton
method of the object. Through the function parameters, you can configure the visual style of the button and handle all the steps of the payment flow.
RevolutPayKit.configure(
with: .init(
merchantPublicKey: "<yourPublicAPIKey>",
environment: .production
)
)
RevolutPayKit.configure
method:
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. Default value: .production . Possible values are:
| Enum | Yes |
This is an example configuration, showing all possible parameters with example values:
let revolutPayKit = RevolutPayKit()
let button = revolutPayKit.button(
style: .init(size: .large),
returnURL: "${my_app_name}://revolut-pay", // <- Change with your actual return URL
savePaymentMethodForMerchant: true,
shouldRequestShipping: true,
customer: .init(
name: "Firstname Lastname",
dateOfBirth: .init(day: 1, month: 1, year: 1980),
email: "example@email.com",
phone: "+441234567890"
),
createOrder: { createOrderHandler in
// Get the order token from your backend
createOrderOnBackEnd { orderToken in
createOrderHandler.set(orderToken: orderToken)
}
},
completion: { result in
switch result {
case .success:
// Handle successful payment
case .failure(let error):
// Handle payment error
case .userAbandonedPayment:
// Handle abandoned payment
}
}
)
RevolutPayKit.button
method:
Parameter | Description | Format | Required |
---|---|---|---|
style | Contains styling parameters of the button. | Object | Yes |
returnURL | Upon payment completion, the Revolut app tries to open this URL. Possible values are:
| String | Yes |
savePaymentMethodForMerchant | If true , the customer gives permission to the merchant to use the payment method (Revolut account or card details saved via Revolut Pay) in the future. The customer only needs to authorise this payment method once, then the merchant can use this payment method to take future payments without further action required from the customer. This feature is useful when managing recurring payments or setting up scheduled payments in the future. To learn more about merchant initiated transactions, see: Create Revolut Pay button: Merchant initiated transactions. Default: false . | Boolean | No |
shouldRequestShipping | If true, the shipping address and delivery method are quickly collected through Revolut Pay from the user. Your backend must support Fast checkout for this functionality to work (for more information, see: Implement Revolut Pay with Fast checkout). Default: false . | Boolean | No |
customer | Object containing customer details the merchant already has. These details can be prefilled upon initializing the widget. Only valid details are prefilled. | Object | No |
createOrder | Callback function handling the order creation operation executed after the user taps the Revolut Pay button. In this callback:
caution The Create an order endpoint was updated to a new version and now returns We strongly advise upgrading to the new Create an order endpoint. | Closure | Yes |
completion | The completion closure acts as a callback to manage the outcomes of payment operations initiated by the RevolutPayKit button. The closure is called once the payment process is concluded, covering scenarios of success, failure, or abandonment by the user. 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 |
RevolutPayButton.Style
object:
Parameter | Description | Format | Required |
---|---|---|---|
size | Size of the button, default: .large . Possible values
| Enum | No |
variants | Color schemes for light and dark modes of the phone, default: VariantModes(anyMode: .dark) . Possible values
| Object | No |
radius | Size of the button's border radius, default: .small . Possible values
| Enum | No |
attachmentStyle | Appearance of the attachment box displayed under the button. Specifies the reward value and currency. Can be initialized with a Text object. Default value: Text(currency: .gbp, cashbackValue: .value25) | Object | No |
RevolutPayButton.Style.Text
object:
Parameter | Description | Format | Required |
---|---|---|---|
currency | The currency displayed in the reward text in ISO 4217 format. Default value: .gbp Possible values
| Enum | No |
cashbackValue | The maximum reward value in the currency that you specified (e.g. £25). Default value: .value25 Possible values are:
| Enum | No |
Customer
object:
Parameter | Description | Format | Required |
---|---|---|---|
name | Customer's name. Example: "Firstname Lastname" | String | No |
email | Customer's email. Example: "example@email.com" | String | No |
phone | Customer's phone number, containing country code and '+' character. Example: "+441234567890" | String | No |
dateOfBirth | Object containing customer's date of birth. | GenericDate | No |
GenericDate
object:
Parameter | Description | Format | Required |
---|---|---|---|
day | Customer's birth day. | UInt, between 1-31 | Yes |
month | Customer's birth month. | UInt, between 1-12 | Yes |
year | Customer's birth year. | UInt, 4 digits | Yes |
To display the button and verify your implementation, see:
This is an example configuration, showing all possible parameters with example values:
let promotionalBanner = revolutPayKit.promotionalBanner(
style: .init(
accentColor: .red,
backgroundColor: .white,
bannerCornerRadius: 8,
componentCornerRadius: .circular,
border: .init(
color: .black,
width: 2
)
),
transactionId: "transaction-id",
amount: 10_00,
currency: .EUR,
customer: .init(
name: "Firstname Lastname",
email: "example@email.com",
phone: "+441234567890",
country: .unitedKingdom
)
)
RevolutPayKit.promotionalBanner
method:
Parameter | Description | Format | Required |
---|---|---|---|
style | Contains styling parameters of the promotional banner. | Object | No |
transactionId | The ID of the transaction sent by the merchant corresponding to the promotional offer. | String | Yes |
amount | The amount paid by the customer, given in minor currency unit. For example, €70.34 is represented by the value 70_34 . | Int64 | No |
currency | The payment currency in ISO 4217 format. Possible values
| Enum | Yes |
customer | Contains customer details the merchant already has. These details can be prefilled upon initializing the widget. Only valid details are prefilled. | Object | No |
PromotionalBanner.PromotionalBannerStyle
object:
Parameter | Description | Format | Required |
---|---|---|---|
accentColor | The banner's accent colour. Other colours in the banner are derived from this. Default: nil | UIColor | No |
backgroundColor | The banner's background colour. Default: nil . | UIColor | No |
bannerCornerRadius | The corner radius of the banner's view. Default: 16.0 | CGFloat | Yes |
componentCornerRadius | The corner radius of the banner's components. Default: .default Possible values
| Enum | Yes |
border | Contains styling parameters of the banner's border. Default: nil | Object | No |
PromotionalBanner.PromotionalBannerStyle.Border
object:
Parameter | Description | Format | Required |
---|---|---|---|
color | The banner's border colour. Default: nil | UIColor | No |
width | The banner's border width in pixels. Default: 1.0 | CGFLoat | Yes |
PromotionalBanner.PromotionalBannerCustomer
object:
Parameter | Description | Format | Required |
---|---|---|---|
name | Customer's name. Example: "Firstname Lastname" . Default: nil | String | No |
email | Customer's email. Example: "example@email.com" . Default: nil | String | No |
phone | Customer's phone number, containing country code and '+' character. Example: "+441234567890" . Default: nil | String | No |
country | Object containing the customer's country code. Example: .unitedKingdom . Default: nil Supported countries
| Enum | No |