Accept payments via Apple Pay - iOS
Welcome to the Revolut Apple Pay SDK for iOS, a powerful tool designed to simplify the integration of Apple Pay into your iOS applications. Our main goal is to help merchants incorporate Revolut's secure and convenient payment solutions via Apple Pay into their apps, offering customers a fast, secure, and seamless payment method.
In this tutorial, we'll walk you through the implementation process of integrating the Apple Pay into your iOS app using the Revolut Apple Pay SDK. By following this guide, you can provide your customers with a seamless and secure checkout experience directly within your app.

Apple Pay is not available in the sandbox environment. Real transactions must be made to test your implementation in the production environment.
How it works
From an implementation perspective, integrating Apple Pay into your iOS app with the Revolut Apple Pay SDK involves the following components:
- Server-side: You need to set up an endpoint on your server that creates an order using the Merchant API: Create an order endpoint.
- Client-side: Your iOS app uses the Revolut Apple Pay SDK to collect payment details and communicates with your server to create the order and process the payment.
- Endpoint for webhooks: Optionally, you can set up an endpoint to receive webhook events from the Merchant API to track the payment lifecycle. For more information, see: Use webhooks to keep track of the payment lifecycle.
The order and payment flow is similar to all payment solutions:
- The customer goes to the checkout screen in your app.
- Your app checks if Apple Pay is supported and displays the Apple Pay button.
- The customer taps the Apple Pay button.
- The Revolut Apple Pay SDK presents the Apple Pay sheet to the customer, who reviews and authorises the payment.
- Your app uses your server endpoint to create an order and obtains the order
token. - The SDK processes the payment and presents the payment result to the customer.
- Optionally, your server receives webhook notifications about each event you're subscribed to.
For more information about the order and payment lifecycle, see: Order and payment lifecycle.
Implementation overview
Check the following high-level overview on how to implement the Apple Pay button in your iOS app:
- Create a Merchant Identifier
- Create an Apple Pay Certificate
- Add the Apple Pay capability to your project
- Install the SDK
- Configure the SDK
- Add the Apple Pay button
- Create the payment request
- Display the Apple Pay sheet
- Verify your implementation
Before you begin
Before you start this tutorial, ensure you have completed the following steps:
Implement the Apple Pay button in your iOS app
1. Create a Merchant Identifier
To enable Apple Pay in your app, you need to register a Merchant Identifier on the Apple Developer portal.
- Log in to your Apple Developer account.
- Navigate to Certificates, Identifiers & Profiles.
- Under Identifiers, select Merchant IDs.
- Click the
+button to create a new Merchant ID. - Follow the prompts to create your Merchant Identifier (e.g.,
merchant.com.yourappname).
For more information, see Configure Apple Pay: Create a merchant identifier.
2. Create an Apple Pay Certificate
To process payments with Apple Pay, you need an Apple Pay Payment Processing Certificate associated with your Merchant Identifier.
- Request a Certificate Signing Request (CSR) file from Revolut by emailing merchant-integration@revolut.com.
- Use the CSR file provided by Revolut to create an Apple Pay Payment Processing Certificate in the Apple Developer portal for the Merchant ID you created earlier.
- In your Apple Developer account, go to Certificates, Identifiers & Profiles.
- Select your Merchant ID and click
Create Certificateunder the Apple Pay Payment Processing Certificate section. - Follow the instructions to upload the CSR file and download the generated certificate (
.cerfile).
- Provide the certificate (
.cerfile) to Revolut by emailing it back to merchant-integration@revolut.com.
Currently, this step is not automated. You must only use one certificate per Merchant ID.
If you want to change the Merchant ID or if the certificate is about to expire, you must repeat this process.
3. Add the Apple Pay capability to your project
To enable Apple Pay in your Xcode project:
- Open your project in Xcode.
- Select your project in the Project Navigator.
- Go to the Signing & Capabilities tab.
- Click the + Capability button.
- Add the Apple Pay capability.
- Select the Merchant ID you created earlier.
For more information, see Apple's documentation on Adding Apple Pay Capabilities.
4. Install the SDK
The Revolut Apple Pay SDK requires a minimum iOS version of 13.0.
CocoaPods
We recommend using CocoaPods to integrate the SDK into your Xcode project.
-
Ensure you have the latest version of CocoaPods installed.
-
If your project doesn't have a
Podfileyet, create one by running:pod init -
Add the following line to your
Podfile:pod 'RevolutPayments/RevolutApplePay' -
Install the dependencies:
pod install -
From now on, open your project using the
.xcworkspacefile rather than the.xcodeprojfile. -
To ensure the SDK uses the latest version, run:
pod update RevolutPayments/RevolutApplePaynoteRun this command to update the SDK to a newer version in the future.
5. Configure the SDK
Import the RevolutPayments module, then configure the SDK at the start of your application by calling the RevolutPayKit.configure(with:) method, typically in your AppDelegate or SceneDelegate.
import RevolutPayments
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
RevolutPaymentsSDK.configure(with: "<yourPublicApiKey>") // Merchant API Public key
return true
}
}
Currently, only the production environment is supported.
6. Add the Apple Pay button
First, create a RevolutApplePayKit object. It provides all the necessary tools for processing the payment.
Create and add the button to your view hierarchy only if Apple Pay is supported on the device. You should use the isApplePaySupported method.
import PassKit
import RevolutPayments
final class CheckoutExampleViewController: UIViewController {
private let revolutApplePayKit = RevolutApplePayKit()
private var applePayButton: PKPaymentButton?
override func viewDidLoad() {
super.viewDidLoad()
// The Apple Pay button is added only if Apple Pay is supported.
guard revolutApplePayKit.isApplePaySupported() else { return }
applePayButton = PKPaymentButton(paymentButtonType: .buy, paymentButtonStyle: .black)
applePayButton?.addTarget(self, action: #selector(handleApplePayButtonTap), for: .touchUpInside)
// Add the button into the view hierarchy.
view.addSubview(applePayButton)
}
...
}
7. Create the payment request
When the Apple Pay button is tapped, you need to first create an Apple Pay payment request.
In your button tap handler, call the makePaymentRequest(merchantId:, totalAmount:, currencyCode:, completion:) method of RevolutApplePayKit. This method initialises a PKPaymentRequest object with some required properties pre-populated according to your Revolut merchant account configuration.
Then configure the returned payment request according to your needs (e.g., setting paymentSummaryItems, shippingMethods, etc.).
Here's how you can implement it:
@objc func handleApplePayButtonTap() {
applePayButton?.isUserInteractionEnabled = false
revolutApplePayKit.makePaymentRequest(
merchantId: "merchant.com.yourappname",
totalAmount: 15_00, // In minor units
currencyCode: "GBP"
) { [weak self] result in
self?.applePayButton?.isUserInteractionEnabled = true
switch result {
case .success(let paymentRequest):
// Apple Pay uses the last element for the grand total.
paymentRequest.paymentSummaryItems = [
PKPaymentSummaryItem(label: "Merchant name", amount: 15.00)
]
self?.presentApplePay(for: paymentRequest) // Defined in the next step
case .failure(let error):
// Handle error (e.g., show an alert to the user)
}
}
}
For more information about the parameters, see: Apple Pay SDK: Methods and parameters.
-
Disable the Apple Pay button: It's a good practice to disable the button while the payment request is being created to prevent duplicate requests.
-
Call
makePaymentRequest: This method initialises aPKPaymentRequestwith some properties set based on your merchant configuration. -
Handle the result: The completion handler provides a
Result<PKPaymentRequest, Error>. On success, you receive aPKPaymentRequestobject. -
Configure
paymentSummaryItems: You must set thepaymentSummaryItemsproperty of thePKPaymentRequest. These items represent the line items and total amount that will be displayed to the user in the Apple Pay sheet.cautionThe last item in
paymentSummaryItemsis considered the grand total and must match the total amount charged. -
Error handling: In case of failure, handle the error appropriately, such as displaying an alert to the user.
-
Optional configurations: You can configure additional properties on the
PKPaymentRequest, for more information, see: Apple's documentation onPKPaymentRequest.
The totalAmount and currencyCode represent the expected total amount for the payment. If the actual total is unknown at this point (e.g., due to variable shipping costs), you can provide a base amount.
The actual total displayed to the user in the Apple Pay sheet is determined by the paymentSummaryItems you set afterwards, which should correspond to the order's total amount.
Currently, recurring and deferred payment requests are not supported by the Revolut Apple Pay SDK.
8. Display the Apple Pay sheet
Present the Apple Pay sheet for your payment request. The presentApplePay method supports multiple callbacks in order to interact with the Apple Pay sheet.
func presentApplePay(for paymentRequest: PKPaymentRequest) {
revolutApplePayKit.presentApplePay(
for: paymentRequest,
onAuthorize: { [weak self] handler in
// Get the order token from your backend - the total price must
// correspond to the one displayed by the Apple Pay sheet
self?.createOrderOnBackend { result in
switch result {
case .success(let orderToken):
handler.set(orderToken: orderToken)
case .failure(let error):
handler.set(errors: [error])
}
}
},
completion: { result in
switch result {
case .success:
// Handle successful payment (e.g., redirection to a confirmation page)
case .failure(let error):
// Handle payment error (e.g., display an error message to the user)
case .userAbandonedPayment:
// Handle abandoned payment
}
}
)
}
The amount specified when creating the order on your backend must match the total amount displayed in the Apple Pay sheet.
The callbacks correspond to PassKit.PKPaymentAuthorizationControllerDelegate methods. You may also consult Apple's documentation for a deeper understanding of how Apple Pay and the callbacks work.
9. Verify your implementation
Currently, only the production environment is supported. This means that real transactions must be made to test your implementation.
Congratulations! You've successfully integrated the Apple Pay SDK with the Revolut Merchant API in your iOS app.
Example project
Check out the example project to test the SDK and better understand how to implement it, in the iOS repository. The example is found under Releases/<SDK-version>/RevolutApplePay/ExampleApp/.