Skip to content

How it works

Learn about PXP's Apple Pay component for iOS applications.

Overview

Apple Pay is one of the most secure and convenient payment methods available, widely adopted across e-commerce, retail, and mobile applications. Apple Pay leverages biometric authentication and device-specific security features to provide customers with a seamless and secure checkout experience that reduces friction and increases conversion rates.

With the Apple Pay component for iOS, you can benefit from:

  • Secure checkout: Use Apple's industry-leading security with tokenized payments, biometric authentication (Touch ID/Face ID), and device-specific encryption that never exposes actual card details.
  • Seamless experience: Provide customers with pre-populated shipping and billing information from their Apple ID, eliminating manual form filling and reducing checkout abandonment.
  • Native integration: Leverage Apple's official PassKit framework and PKPaymentAuthorizationController that customers recognise and trust, maintaining consistency with their device experience.
  • Real-time updates: Dynamically update totals, shipping costs, and available options based on customer selections without requiring view reloads.
  • Flexible customisation: Choose between Apple's official PKPaymentButton rendering or custom SwiftUI/UIKit implementation to match your brand while maintaining Apple Pay compliance.
  • Multi-network support: Accept payments from major card networks including Visa, Mastercard, American Express, and Discover through a single integration.

The Apple Pay component will automatically determine availability based on the customer's device capabilities and configured payment methods. Apple Pay is available on iOS devices with Touch ID, Face ID, or passcode authentication, and requires the customer to have a supported payment method configured in their Wallet app.

Rendering methods

The Apple Pay component for iOS offers multiple rendering approaches to accommodate different integration needs:

Use Apple's official PKPaymentButton class for authentic appearance and behaviour. With automatic updates from Apple and built-in accessibility features, this is the simplest way to provide a consistent user experience.

let config = ApplePayButtonComponentConfig()
config.buttonType = .buy
config.buttonStyle = .black
config.buttonRadius = 8.0

let applePayComponent = try checkout.create(.applePayButton, componentConfig: config)

Custom SwiftUI content

Get complete control over button appearance while maintaining Apple Pay functionality. With advanced styling options, custom animations, and effects, you can match the button to your brand's look and feel.

config.customContent = {
    return AnyView(
        HStack {
            Image(systemName: "applelogo")
                .foregroundColor(.white)
            Text("Buy with Apple Pay")
                .foregroundColor(.white)
                .fontWeight(.semibold)
        }
        .frame(maxWidth: .infinity, minHeight: 50)
        .background(Color.black)
        .cornerRadius(8)
    )
}

Custom UIKit implementation

For applications using UIKit, you can create custom button implementations while maintaining Apple Pay integration:

class CustomApplePayButton: UIButton {
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupAppearance()
    }
    
    private func setupAppearance() {
        setTitle("Pay with Apple Pay", for: .normal)
        backgroundColor = .black
        layer.cornerRadius = 8
        titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .semibold)
    }
}

Payment flows

You can configure the component to drive your desired flow:

Immediate payment flow

A synchronous, single-step payment process where the customer completes the payment immediately during checkout and you receive the payment confirmation right away.

config.onPostAuthorisation = { result in
    if let authorizedResult = result as? AuthorisedSubmitResult {
        // Payment completed immediately
        print("Payment successful: \(authorizedResult.provider.code)")
        DispatchQueue.main.async {
            self.navigateToSuccess()
        }
    }
}

Authorisation flow

An asynchronous, two-step payment process where the customer authorises the payment and you choose whether to capture the funds later. This provides flexibility for order validation and inventory management.

config.onPreAuthorisation = {
    return ApplePayTransactionInitData(
        intent: .confirm, // Authorize only
        riskScreeningData: RiskScreeningData(
            performRiskScreening: true
        )
    )
}

config.onPostAuthorisation = { result in
    if let authorizedResult = result as? AuthorisedSubmitResult {
        // Authorisation successful, capture later
        print("Authorisation successful: \(authorizedResult.provider.code)")
        self.scheduleCapture(authorizationId: authorizedResult.provider.code)
    }
}

Key differences

AspectImmediate paymentAuthorisation flow
IntentCaptureConfirm followed by Capture.
ProcessCaptures payment immediately in one step.Stores authorisation, later captures funds after order validation.
ConfirmationNo additional confirmation needed.Requires confirmation step with capture logic.
FlexibilityImmediate payment completion.Can adjust order, validate inventory, and calculate final costs.
Use casesDigital products and simple orders.Complex orders, inventory validation, and shipping calculation.
Time limitImmediate settlement.Authorisation valid for up to 7 days before expiration.

Supported transaction intents

When you initiate a transaction, you provide key information about the transaction method, amount, and currency.

The transaction method consists of:

  • The entry type, which describes the origin of the transaction. For Apple Pay for iOS, this is always MobileApp (mobile application).
  • The funding type, which describes the payment method used (Apple Pay wallet).
  • The intent, which describes the purpose and flow of the transaction.

Apple Pay supports the following intents:

IntentDescriptioniOS Implementation
CreateInitialise a payment session and prepare for authorisation.Set up PKPaymentRequest.
ConfirmAuthorise a payment and hold funds for later capture.Use onPreAuthorisation with confirm intent,
CaptureTransfer authorised funds to your account and complete the transaction.Immediate capture in onPostAuthorisation.
VoidCancel a transaction that has been authorised but not captured.Server-side void operation.
RefundReturn funds to a customer for a completed transaction.Server-side refund operation.

Supported regions

Apple Pay availability varies by region and is automatically detected by the component:

Apple Pay availability varies by region and is automatically detected by the component:

  • Americas: United States, Canada, Mexico, Brazil.
  • Europe: United Kingdom, France, Germany, Italy, Spain, Netherlands, and 40+ other countries.
  • Asia-Pacific: Australia, China, Hong Kong, Japan, Singapore, South Korea, and others. For a full list of supported countries and regions, see Apple's official website.

The component automatically detects regional availability and only displays the Apple Pay button when the service is available in the customer's location and on their device.