This page contains information about the available methods and parameters of the Apple Pay iOS SDK.
For detailed instructions on how to install and integrate the SDK, see: Accept payments via Revolut Merchant Card Form SDK - 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: "<yourPublicAPIKey>",
environment: .production
)
)
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 . note Currently, only the production environment is available.
| Environment | Yes |
RevolutApplePayKit.isApplePaySupported
methodDetermines whether the user's devices can process payment requests.
RevolutApplePayKit.isApplePaySupported() -> Bool
RevolutApplePayKit.makePaymentRequest
methodCreates the Apple Pay payment request with some required properties pre-populated according to your Revolut merchant account configuration and the parameters passed, as required for the payment processing.
RevolutApplePayKit.makePaymentRequest(
merchantId: String,
totalAmount: Int64,
currencyCode: String,
completion: @escaping (Result<PKPaymentRequest, Error>) -> Void
)
Parameter | Description | Format | Required |
---|---|---|---|
merchantId | The Apple Pay Merchant ID registered on the Apple Developer portal (e.g., merchant.com.yourapp ). | String | Yes |
totalAmount | The payment amount in minor units (e.g., cents for USD). | Int64 | Yes |
currencyCode | The 3-letter ISO 4217 currency code, used by the payment request. | String | Yes |
completion | The closure called upon payment request creation completion. This method is asynchronous, so you should handle the UI during its execution. | Closure | Yes |
supportedNetworks
, merchantCapabilities
, merchantIdentifier
, countryCode
, currencyCode
, requiredBillingContactFields
, requiredShippingContactFields
.paymentSummaryItems
).emailAddress
from requiredShippingContactFields
).RevolutApplePayKit.presentApplePay
methodPresents the Apple Pay sheet configured according to the payment request. The payment is processed through Revolut.
RevolutApplePayKit.presentApplePay(
for paymentRequest: PKPaymentRequest,
onAuthorize: @escaping AuthorizePaymentCallback,
onSelectShippingMethod: UpdateShippingMethodCallback? = nil,
onSelectShippingContact: UpdateShippingContactCallback? = nil,
completion: @escaping CompletionCallback
)
Parameter | Description | Format | Required |
---|---|---|---|
paymentRequest | A PKPaymentRequest object configured with payment details obtained from the payment request made by the makePaymentRequest helper method. | Object | Yes |
onAuthorize | A callback triggered when the user authorises the payment to create an order via a backend request. Retrieve the order's token , and pass it to the SDK, using the set(orderToken:) method of the closure's RevolutApplePayKit.AuthorizePaymentCallbackHandler parameter. | Closure | Yes |
onSelectShippingMethod | A callback triggered when the user selects a shipping method. Allows you to validate it and update the sheet accordingly. | Closure | No |
onSelectShippingContact | A callback triggered when the user selects a shipping contact. Allows you to validate it and update the sheet accordingly. | Closure | No |
completion | A callback triggered with the final result of the payment process (.success , .failure , .userAbandonedPayment ). | Closure | Yes |
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.
RevolutApplePayKit.Error
enumerationError types returned by the Revolut Apple Pay SDK. The Error
enumeration defines a set of error types that can occur during the payment process, returned by the .failure
case of the completion
closure.
RevolutApplePayKit.Error(
case `internal`(Swift.Error)
case kitAlreadyInUse
case paymentFailed(PaymentError)
case presentationFailed
)
Case | Description |
---|---|
internal(Swift.Error) | Returned when an internal error occurs within the SDK. |
kitAlreadyInUse | Returned when the RevolutApplePayKit instance is already being used by a flow (e.g., when trying to present the Apple Pay sheet while it is already displayed). |
paymentFailed(PaymentError) | Returned when the payment fails. The associated PaymentError provides detailed information about the specific reason for the failure. |
presentationFailed | Returned when presenting the Apple Pay sheet fails. |
RevolutApplePayKit.Error.PaymentError
enumerationThe PaymentError
enumeration is returned by the paymentFailed
case of the RevolutApplePayKit.Error
enumeration. These errors provide detailed information about what went wrong, and help developers handle various failure scenarios appropriately.
RevolutApplePayKit.Error.PaymentError(
case highRisk
case insufficientFunds
case invalidCVV
case invalidEmail
case invalidTransaction
case issuerDecline
case orderCreationFailure
case other
case paymentAttemptBlocked
case restrictedCard
case suspectedFraud
case unknownCard
)
Errors not found on the list are mapped to the other
case. For more information about the error cases, see: Decline reasons.