This page contains information about the available parameters for the Revolut Pay iOS SDK. For detailed instructions on how to install the SDK, see: Tutorials: 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 | 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 error
}
}
)
RevolutPayKit.button
method:
Parameter | Description | Format | Required |
---|---|---|---|
style | Contains styling parameters of the button. | Object | Yes |
returnURL | The URL which Revolut app tries to open upon payment completion. 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 is called upon payment completion or failure. It will always be called, even if the user abandons the payment. If the result is success , the user has successfully finalized the payment. If the result is failure , you should treat it accordingly.note According to your UX guidelines, you might or might not want to ignore the userAbandonedPayment error case, as it is thrown even when the user simply dismisses the web view flow. | 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(
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 |
---|---|---|---|
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.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 |