Merchant iOS SDKs
Methods and parameters
doc

Apple Pay iOS SDK

This page contains information about the available methods and parameters of the Apple Pay iOS SDK.

info

For detailed instructions on how to install and integrate the SDK, see: Accept payments via Revolut Merchant Card Form SDK - iOS.

Methods and parameters

RevolutPaymentsSDK.configure method

The 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
)
)
ParameterDescriptionFormatRequired
merchantPublicKeyThe merchant's public API key used for authorization.StringYes
environmentThis parameter specifies the environment in which the SDK operates. If omitted it defaults to .production.

note
Currently, only the production environment is available.
Possible values are:
  • .production
EnvironmentYes

RevolutApplePayKit.isApplePaySupported method

Determines whether the user's devices can process payment requests.

RevolutApplePayKit.isApplePaySupported() -> Bool

RevolutApplePayKit.makePaymentRequest method

Creates 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
)
ParameterDescriptionFormatRequired
merchantIdThe Apple Pay Merchant ID registered on the Apple Developer portal (e.g., merchant.com.yourapp).StringYes
totalAmountThe payment amount in minor units (e.g., cents for USD).Int64Yes
currencyCodeThe 3-letter ISO 4217 currency code, used by the payment request.StringYes
completionThe closure called upon payment request creation completion. This method is asynchronous, so you should handle the UI during its execution.ClosureYes

Notes

  • Pre-populated properties: supportedNetworks, merchantCapabilities, merchantIdentifier, countryCode, currencyCode, requiredBillingContactFields, requiredShippingContactFields.
  • You must set the rest of the properties according to your needs (e.g., paymentSummaryItems).
  • If you omit the billing or contact fields required by the SDK, they will be re-added by the SDK on flow start (e.g., emailAddress from requiredShippingContactFields).

RevolutApplePayKit.presentApplePay method

Presents 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
)
ParameterDescriptionFormatRequired
paymentRequestA PKPaymentRequest object configured with payment details obtained from the payment request made by the makePaymentRequest helper method.ObjectYes
onAuthorizeA 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.ClosureYes
onSelectShippingMethodA callback triggered when the user selects a shipping method. Allows you to validate it and update the sheet accordingly.ClosureNo
onSelectShippingContactA callback triggered when the user selects a shipping contact. Allows you to validate it and update the sheet accordingly.ClosureNo
completionA callback triggered with the final result of the payment process (.success, .failure, .userAbandonedPayment).ClosureYes
info

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.

Errors

RevolutApplePayKit.Error enumeration

Error 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
)
CaseDescription
internal(Swift.Error)Returned when an internal error occurs within the SDK.
kitAlreadyInUseReturned 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.
presentationFailedReturned when presenting the Apple Pay sheet fails.

RevolutApplePayKit.Error.PaymentError enumeration

The 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
)
info

Errors not found on the list are mapped to the other case. For more information about the error cases, see: Decline reasons.

Was this page helpful?