Apple Pay with AI agents
Use Apple Pay through PassKit for real-world goods, services or donations in the app. Register a merchant identifier, create a Payment Processing certificate, and enable the Apple Pay capability in Xcode. Present a payment sheet from a PKPaymentRequest. Digital in-app goods belong to StoreKit, not Apple Pay. Look up Apple's PassKit docs first.
Last updated:
Apple facts are from "PassKit (Apple Pay and Wallet)", "Setting up Apple Pay", "Offering Apple Pay in Your App", "PKPaymentAuthorizationController", "PKPaymentRequest", "PayWithApplePayButton", "PKPaymentButton", "Merchant IDs Entitlement" and "Complying with regional regulations" on developer.apple.com. Tool facts are from each README. Stars as of 14 Nov 2026.
What Apple documents
The PassKit framework lets you add Apple Pay to your app and manage passes in Wallet. Apple Pay is a way for users to make purchases in stores, in apps and on the web. When you use PassKit to support Apple Pay in iOS and watchOS apps, users can purchase real-world goods and services, or donate to nonprofit organizations, without leaving the app. For digital goods and services delivered within the app, Apple points you to StoreKit instead (StoreKit and in-app purchases with AI agents). Apple Pay on the web is a separate document set.
To set up Apple Pay you complete three steps: create a merchant identifier, create a Payment Processing certificate, and enable Apple Pay in Xcode. The merchant identifier uniquely identifies your business as a merchant able to accept payments; it never expires, and you can use it in multiple websites and apps. Apple Pay servers use the certificate’s public key to encrypt payment data; you or your payment service provider use the private key to decrypt it. If you use an e-commerce provider or payment platform, contact them about using their service with Apple Pay.
In Xcode, open the target’s Signing & Capabilities tab, add the Apple Pay capability, refresh merchant identifiers from the Apple Developer site, and select the merchant identifier to use with the app. The Merchant IDs entitlement (
com.apple.developer.in-app-payments) is a list of merchant IDs your app uses for Apple Pay. You can use the same merchant ID and Payment Processing certificate for a website, but Apple Pay on the web requires additional setup that this page does not cover.Check whether the device can pay with
PKPaymentAuthorizationController.canMakePayments()and whether it has a card on a supported network withcanMakePayments(usingNetworks:). OfferPKPaymentButton(UIKit) orPayWithApplePayButton(the SwiftUI equivalent). Types include a payment button and a set-up button when the person can add a card. For WatchKit, useWKInterfacePaymentButton. Follow the Human Interface Guidelines for Apple Pay buttons.Create a
PKPaymentRequestas soon as a person taps the Apple Pay button. The request describes the merchant, payment networks, payment summary, billing and shipping details, coupon codes and related information. If customers need to enter a discount code, choose a shipping method, or complete another task, ask for that information before they tap the Apple Pay button. A request is typically a one-time payment; you can instead attach one of a recurring, automatic-reload or deferred payment request, and only one of those optional types at a time.Present the payment sheet with
PKPaymentAuthorizationController. It performs the same role asPKPaymentAuthorizationViewControllerbut does not depend on UIKit, so it can be used in watchOS apps or SiriKit extensions. After authorization, the delegate receives a payment token. Complete the transaction withPKPaymentAuthorizationResult. When Apple Pay is finished, it callspaymentAuthorizationControllerDidFinish(_:), and the system dismisses the sheet as appropriate for the platform.Running the official sample on an iPhone or Apple Watch requires an Apple Pay card. Running in Simulator does not require a card, but not all Apple Pay features are supported in the iOS simulator, and testing Apple Pay is unsupported in the watchOS simulator.
Some regions have extra rules. Apple documents that UK and EEA transactions may be subject to PSD2, that Saudi Arabia requires the mada network for domestic debit, and that the UAE requires the Jaywan network for domestic debit and prepaid. The list may not be complete; check with your payment service provider or the appropriate authorities.
Rules for AGENTS.md
Code
- Use Apple Pay (PassKit) only for real-world goods and services, or donations, in this app. Use StoreKit for digital goods and services delivered in the app. Do not treat the two as interchangeable.
- Register a merchant identifier, create a Payment Processing certificate, and enable the Apple Pay capability in Xcode with the matching merchant ID (com.apple.developer.in-app-payments). Do not invent a merchant ID.
- Build a PKPaymentRequest when the person taps the Apple Pay button. Collect discount codes, shipping method or other choices before that tap.
- Present the sheet with PKPaymentAuthorizationController (or PayWithApplePayButton in SwiftUI). Complete authorization with PKPaymentAuthorizationResult and handle paymentAuthorizationControllerDidFinish(_:).
- Check canMakePayments() / canMakePayments(usingNetworks:) before showing a pay or set-up button. Look up Apple's PassKit and “Setting up Apple Pay” docs before adding the capability or the payment sheet.Step 1: ground the agent in Apple's Apple Pay docs
Install Apple Docs MCP or Sosumi and ask it to open “Setting up Apple Pay”, “Offering Apple Pay in Your App”, “PKPaymentAuthorizationController” and “PKPaymentRequest”. Confirm the goods are real-world (or a donation), not a digital in-app purchase.
Step 2: set up the merchant identity and capability
Have the agent walk through creating a merchant identifier and a Payment Processing certificate, then adding the Apple Pay capability on the app target and selecting that merchant ID. Do not let it invent entitlement strings.
Step 3: build the request and present the sheet
Implement canMakePayments checks, a PKPaymentButton or PayWithApplePayButton, a PKPaymentRequest, and PKPaymentAuthorizationController. Collect shipping or coupon details before the button is tapped. Complete the delegate with PKPaymentAuthorizationResult and dismiss on didFinish.
Step 4: review the SwiftUI around the pay button
Run swiftui-pro on the screen that hosts the Apple Pay button, so layout, contrast and the button’s size stay current. Do not restyle the system Apple Pay button beyond the documented types and styles.
Tools compared (4)
| Tool | Best for | Agents (README) | Install (README) | License | Stars | Last push |
|---|---|---|---|---|---|---|
| Apple Docs MCP (kimsungwhee) | Look up PassKit, merchant entitlements and payment-sheet APIs | Claude Code, Cursor, VS Code, Windsurf | claude mcp add apple-docs -- npx -y @kimsungwhee/apple-docs-mcp@latest | MIT | 1387 | 17 Mar 2026 ⚠ |
| sosumi.ai (NSHipster) | Pull Apple PassKit and Apple Pay docs as Markdown | any MCP host | npx -y mcp-remote https://sosumi.ai/mcp | MIT | 491 | 13 Nov 2026 |
| ApKI (Gucky) | Route the agent to official Apple developer resources | Codex, Claude Code | npx skills add https://github.com/Gucky/ApKI --skill apki | MIT | 2 | 3 Nov 2026 |
| swiftui-pro (twostraws) | Modern SwiftUI around the screen that hosts the pay button | Claude Code, Cursor, Codex, Gemini | npx skills add https://github.com/twostraws/SwiftUI-Agent-Skill --skill swiftui-pro | MIT | 6552 | 26 Oct 2026 |
⚠ = no push in the last 4 weeks.
Which one to pick
Official API lookup → Apple Docs MCP or Sosumi.
A short route into Apple's current developer resources → ApKI.
SwiftUI around the pay button → swiftui-pro.
A prompt that keeps the agent honest
Code
Add Apple Pay for a real-world ticket purchase in this iOS app. Do not use StoreKit; this is not a digital in-app good. Register or reuse a merchant identifier, create a Payment Processing certificate, and enable the Apple Pay capability with that merchant ID. Check PKPaymentAuthorizationController.canMakePayments and canMakePayments(usingNetworks:) before showing PayWithApplePayButton or PKPaymentButton. Build a PKPaymentRequest when the button is tapped (collect shipping or coupon details before that). Present PKPaymentAuthorizationController, complete authorization with PKPaymentAuthorizationResult, and handle paymentAuthorizationControllerDidFinish. Do not invent a merchant ID or restyle the system Apple Pay button beyond documented types and styles. Look up “Setting up Apple Pay”, “Offering Apple Pay in Your App”, PKPaymentAuthorizationController and PKPaymentRequest in Apple's docs first.FAQ
- Is Apple Pay the same as StoreKit in-app purchases?
- No. Apple documents Apple Pay through PassKit for real-world goods and services, and for donations, in iOS and watchOS apps. For digital goods and services delivered within the app, Apple points you to StoreKit instead. Do not use one in place of the other.
- What do I have to set up before writing payment-sheet code?
- Create a merchant identifier, create a Payment Processing certificate, and enable the Apple Pay capability in Xcode, selecting that merchant ID. The Merchant IDs entitlement (`com.apple.developer.in-app-payments`) lists the IDs the app uses. You can reuse the same merchant ID on a website, but Apple Pay on the web needs additional setup that this page does not cover.
- Which API presents the Apple Pay sheet?
- `PKPaymentAuthorizationController` presents the sheet that asks the person to authorize a `PKPaymentRequest`. It performs the same role as `PKPaymentAuthorizationViewController` but does not depend on UIKit, so it can be used in watchOS apps or SiriKit extensions. In SwiftUI, `PayWithApplePayButton` is the equivalent of `PKPaymentButton` for starting the payment.
- Can I test Apple Pay in Simulator?
- Apple’s sample notes that running in Simulator does not require a card, but not all Apple Pay features are supported in the iOS simulator, and testing Apple Pay is unsupported in the watchOS simulator. Running the sample on an iPhone or Apple Watch requires an Apple Pay card.
- Which tools should the agent use first?
- Apple Docs MCP or Sosumi, so the agent opens “Setting up Apple Pay”, “Offering Apple Pay in Your App”, “PKPaymentAuthorizationController” and “PKPaymentRequest” instead of inventing entitlements or treating Apple Pay as StoreKit. Add swiftui-pro for the SwiftUI around the pay button.