Integrate Apple Pay payments and Wallet passes using PassKit. Use when adding Apple Pay buttons, creating payment requests, handling payment authorization, adding passes to Wallet, configuring merchant capabilities, managing shipping/contact fields, or working with PKPaymentRequest, PKPaymentAuthorizationController, PKPaymentButton, AddPassToWalletButton, PKPass, PKAddPassesViewController, PKPassLibrary, Wallet pass distribution, or Apple Pay checkout flows for physical goods, real-world service
A hands-on reference for integrating Apple Pay payments and Wallet passes with PassKit, targeting Swift 6.3 and iOS 26+. It covers accepting Apple Pay for physical goods, real-world services, donations, and eligible recurring payments, and adding passes to a user's Wallet, spanning payment buttons, requests, authorization, passes, and merchant configuration. Setup walks through enabling the Apple Pay capability, creating a Merchant ID (merchant.com.example.app format), installing a Payment Processing Certificate, and adding the merchant ID to entitlements. It stresses checking device eligibility with PKPaymentAuthorizationController.canMakePayments() and canMakePayments(usingNetworks:capabilities:) before showing Apple Pay UI, noting Apple's HIG expectation that Apple Pay be a prominent option wherever the active-card check is used. Button guidance shows the SwiftUI PayWithApplePayButton and UIKit PKPaymentButton, the full list of button types (such as .buy, .donate, .subscribe, .checkout), and the rule that custom buttons must not carry the Apple Pay logo or wordmark. Building a PKPaymentRequest is detailed with merchant identifier, country and currency codes, supported networks, and merchant capabilities, using NSDecimalNumber rather than Double for amounts, with the last paymentSummaryItem treated as the total. Requesting shipping and contact fields, defining PKShippingMethod options, and setting shippingType are shown, along with the supported-network table and runtime querying via availableNetworks(). Presentation uses PKPaymentAuthorizationController, retained for the sheet's lifetime because its delegate is weak, and authorization is handled through PKPaymentAuthorizationControllerDelegate, forwarding payment.token to a processor and returning a PKPaymentAuthorizationResult, plus handling shipping changes and finishing and dismissing. It also notes that a single PKPaymentRequest may set only one advanced request type (recurring, automatic reload, deferred, Apple Pay Later availability, or multi-token) and to use separate requests otherwise. Useful for building checkout flows or Wallet pass distribution.
Verify PKPaymentAuthorizationController.canMakePayments(), then canMakePayments(usingNetworks:capabilities:) for the specific networks you support, before showing any Apple Pay UI.
PassKit amount APIs take NSDecimalNumber, not Double; construct them with NSDecimalNumber(string:).
The last item in paymentSummaryItems is treated as the total, and its label appears on the Pay line of the payment sheet.
Because its delegate is weak, so you must hold the controller for the life of the sheet or the payment flow will break.
No. A single PKPaymentRequest can set only one advanced request type; use separate payment requests when a checkout needs more than one mode.
Quick Setup:
.claude/skills/Repository
dpearson2699/swift-ios-skills