How to add Apple Pay to an iOS app
Why you need Apple Pay
Apple Pay removes the friction of typing card details, which raises checkout conversion for real-world purchases: ordering food, booking a service, buying merchandise. The user taps a button, confirms with Face ID, and the payment goes through your processor. The boundary that matters: Apple Pay is allowed for physical goods and services delivered outside the app, while anything digital and consumed in the app must go through StoreKit instead.
Adding it with AppFlight, and manually
In AppFlight you describe a physical-goods checkout, and the AI adds the Apple Pay capability, the payment button, and the PassKit flow, connected to your Stripe connector for the actual charge. AppFlight keeps the Stripe secret key server-side in your Supabase and ships only the publishable key, since the secret must never reach the binary. If you describe selling digital content, AppFlight steers you to StoreKit instead, because Apple Pay is not allowed there.
Manually, you register a merchant ID in your developer account, add the Apple Pay capability, configure the merchant ID with your processor, present a PKPaymentRequest, and send the resulting payment token to your backend to complete the charge.
A SwiftUI example
Present the Apple Pay button for a physical-goods purchase:
import PassKit
import SwiftUI
struct CheckoutView: View {
var body: some View {
PayWithApplePayButton(.buy) {
let request = PKPaymentRequest()
request.merchantIdentifier = "merchant.com.example.store"
request.supportedNetworks = [.visa, .masterCard, .amex]
request.merchantCapabilities = .threeDSecure
request.countryCode = "US"
request.currencyCode = "USD"
request.paymentSummaryItems = [
PKPaymentSummaryItem(label: "T-shirt", amount: 25.00)
]
return request
} onPaymentAuthorizationChange: { phase in
// Send the payment token to your backend to charge via your processor.
}
.frame(height: 50)
}
}
Common pitfalls
The biggest mistake is using Apple Pay to sell digital goods, which violates guideline 3.1.1 and will be rejected, so confirm your product is physical first. Forgetting that Apple Pay still needs a processor leaves you with an authorized payment that never charges a card. Misconfiguring the merchant ID between Apple and your processor makes the sheet fail. Not handling the cancel and failure cases leaves the user without feedback. Keep the processor's secret key on your backend, never in the app.
FAQ
Can I use Apple Pay to sell digital content in my app?
No. Apple Pay and Stripe are for physical goods and services delivered outside the app, like a meal, a ride, or merchandise. Digital content used in the app must use StoreKit in-app purchase under guideline 3.1.1.
Do I need a payment processor with Apple Pay?
Yes. Apple Pay handles the card and authorization, but a processor such as Stripe actually charges the card and settles the money. Apple Pay is a payment method on top of your processor, not the processor itself.
What is a merchant ID?
A merchant identifier you register in your Apple Developer account, used to identify your business in Apple Pay transactions. You also add the Apple Pay capability to the app and configure the identifier with your processor.