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 services, donations, and eligible recurring payments.
npx skills add https://github.com/dpearson2699/swift-ios-skills --skill passkit
Accept Apple Pay payments for physical goods, real-world services, donations,
and eligible recurring payments, and add passes to the user's Wallet. Covers
payment buttons, payment requests, authorization, Wallet passes, and merchant
configuration. Targets Swift 6.3 / iOS 26+.
For advanced Apple Pay flows, one PKPaymentRequest can set only one optional
advanced request type: recurring, automatic reload, deferred, Apple Pay Later
availability, or multi-token contexts. Use separate payment requests when a
checkout needs more than one of those modes.
merchant.com.example.app)Always verify the device can make payments before showing Apple Pay UI. If you
check for an active card with canMakePayments(usingNetworks:capabilities:),
Apple's HIG expects Apple Pay to be a primary, prominent payment option wherever
you use that check.
import PassKit
func canMakePayments() -> Bool {
// Check device supports Apple Pay at all
guard PKPaymentAuthorizationController.canMakePayments() else {
return false
}
// Check user has cards for the networks you support
return PKPaymentAuthorizationController.canMakePayments(
usingNetworks: [.visa, .masterCard, .amex, .discover],
capabilities: .threeDSecure
)
}
Use the built-in PayWithApplePayButton view in SwiftUI. Use Apple-provided
button APIs for any control labeled Apple Pay; custom buttons must not include
the Apple Pay logo or "Apple Pay" text.
import SwiftUI
import PassKit
struct CheckoutView: View {
var body: some View {
PayWithApplePayButton(.buy) {
startPayment()
}
.payWithApplePayButtonStyle(.black)
.frame(height: 48)
.padding()
}
}
Use PKPaymentButton for UIKit-based interfaces.
let button = PKPaymentButton(
paymentButtonType: .buy,
paymentButtonStyle: .black
)
button.cornerRadius = 12
button.addTarget(self, action: #selector(startPayment), for: .touchUpInside)
Button types: .plain, .buy, .setUp, .inStore, .donate,
.checkout, .continue, .book, .subscribe, .reload, .addMoney,
.topUp, .order, .rent, .support, .contribute, .tip
Build a PKPaymentRequest with your merchant details and the items being purchased.
PassKit amount APIs take NSDecimalNumber, not Double.
func createPaymentRequest() -> PKPaymentRequest {
let request = PKPaymentRequest()
request.merchantIdentifier = "merchant.com.example.app"
request.countryCode = "US"
request.currencyCode = "USD"
request.supportedNetworks = [.visa, .masterCard, .amex, .discover]
request.merchantCapabilities = .threeDSecure
request.paymentSummaryItems = [
PKPaymentSummaryItem(
label: "Widget",
amount: NSDecimalNumber(string: "9.99")
),
PKPaymentSummaryItem(
label: "Shipping",
amount: NSDecimalNumber(string: "4.99")
),
PKPaymentSummaryItem(
label: "My Store",
amount: NSDecimalNumber(string: "14.98")
) // Total
]
return request
}
The last item in paymentSummaryItems is treated as the total and its label
appears in the Pay line on the payment sheet.
Request only the contact fields needed to price, fulfill, or legally process the
order.
Collect required product choices, optional notes, per-item shipping destinations,
and pickup locations before the Apple Pay button when the payment sheet cannot
collect them accurately.
request.requiredShippingContactFields = [.postalAddress, .emailAddress, .name]
request.requiredBillingContactFields = [.postalAddress]
let standard = PKShippingMethod(
label: "Standard",
amount: NSDecimalNumber(string: "4.99")
)
standard.identifier = "standard"
standard.detail = "5-7 business days"
let express = PKShippingMethod(
label: "Express",
amount: NSDecimalNumber(string: "9.99")
)
express.identifier = "express"
express.detail = "1-2 business days"
request.shippingMethods = [standard, express]
request.shippingType = .shipping // .delivery, .storePickup, .servicePickup
| Network | Constant |
|---|---|
| Visa | .visa |
| Mastercard | .masterCard |
| American Express | .amex |
| Discover | .discover |
| China UnionPay | .chinaUnionPay |
| JCB | .JCB |
| Maestro | .maestro |
| Electron | .electron |
| Interac | .interac |
Query available networks at runtime with PKPaymentRequest.availableNetworks().
Use PKPaymentAuthorizationController (works in both SwiftUI and UIKit, no view controller needed). The controller's delegate is weak, so retain the controller for the life of the sheet.
final class CheckoutCoordinator: NSObject {
private var paymentController: PKPaymentAuthorizationController?
@MainActor
func startPayment() {
let controller = PKPaymentAuthorizationController(
paymentRequest: createPaymentRequest()
)
paymentController = controller
controller.delegate = self
controller.present { [weak self] presented in
if !presented {
self?.paymentController = nil
}
}
}
}
Implement PKPaymentAuthorizationControllerDelegate to process the payment token.
extension CheckoutCoordinator: PKPaymentAuthorizationControllerDelegate {
func paymentAuthorizationController(
_ controller: PKPaymentAuthorizationController,
didAuthorizePayment payment: PKPayment,
handler completion: @escaping (PKPaymentAuthorizationResult) -> Void
) {
// Send payment.token.paymentData to your payment processor
Task {
do {
try await paymentService.process(payment.token)
completion(PKPaymentAuthorizationResult(status: .success, errors: nil))
} catch {
completion(PKPaymentAuthorizationResult(status: .failure, errors: [error]))
}
}
}
func paymentAuthorizationControllerDidFinish(
_ controller: PKPaymentAuthorizationController
) {
controller.dismiss { [weak self] in
self?.paymentController = nil
}
}
}
func paymentAuthorizationController(
_ controller: PKPaymentAuthorizationController,
didSelectShippingMethod shippingMethod: PKShippingMethod,
handler completion: @escaping (PKPaymentRequestShippingMethodUpdate) -> Void
) {
let updatedItems = recalculateItems(with: shippingMethod)
let update = PKPaymentRequestShippingMethodUpdate(paymentSummaryItems: updatedItems)
completion(update)
}
Load signed .pkpass data, verify the device can add passes, then present
PKAddPassesViewController when you want the user to review the pass before
adding it. PKPass(data:) expects signed pass data and can throw invalid-data
or invalid-signature errors. Name invalid-data and invalid-signature
failures explicitly instead of hiding them behind a bare try? in review
guidance.
func addPassToWallet(data: Data) {
guard PKAddPassesViewController.canAddPasses() else {
return
}
do {
let pass = try PKPass(data: data)
guard let addController = PKAddPassesViewController(pass: pass) else {
return
}
addController.delegate = self
present(addController, animated: true)
} catch {
// Signed pass data is invalid or the signature cannot be validated.
showRecoverablePassError(error)
}
}
Use AddPassToWalletButton as the SwiftUI equivalent to PKAddPassButton.
import PassKit
import SwiftUI
struct AddPassButton: View {
let passData: Data
@State private var addedToWallet = false
var body: some View {
if PKAddPassesViewController.canAddPasses(),
let pass = try? PKPass(data: passData) {
AddPassToWalletButton([pass]) { added in
addedToWallet = added
}
.addPassToWalletButtonStyle(.blackOutline)
.frame(width: 250, height: 50)
}
}
}
Use PKPassLibrary to inspect and manage passes the user already has. Check
PKPassLibrary.isPassLibraryAvailable() before pass-library operations, but use
PKAddPassesViewController.canAddPasses() to decide whether the device can add
passes. passes() only returns passes your app can access through its
entitlements. When replacing an existing pass, check the Boolean result from
replacePass(with:) and handle failure. For signed pass bundle construction,
update web services, and replacePass(with:), read
references/wallet-passes.md.
let library = PKPassLibrary()
// Check if a specific pass is already in Wallet
let hasPass = library.containsPass(pass)
// Retrieve passes your app can access
let passes = library.passes()
// Check if pass library is available
guard PKPassLibrary.isPassLibraryAvailable() else { return }
Apple Pay (PassKit) is for **physical goods, real-world services, donations, and
eligible recurring payments**. StoreKit is for virtual goods, app features, and
digital-content subscriptions. Using the wrong framework leads to App Review
rejection.
// WRONG: Merchant ID scattered across the codebase
let request1 = PKPaymentRequest()
request1.merchantIdentifier = "merchant.com.example.app"
// ...elsewhere:
let request2 = PKPaymentRequest()
request2.merchantIdentifier = "merchant.com.example.app" // easy to get out of sync
// CORRECT: Centralize configuration
enum PaymentConfig {
static let merchantIdentifier = "merchant.com.example.app"
static let countryCode = "US"
static let currencyCode = "USD"
static let supportedNetworks: [PKPaymentNetwork] = [.visa, .masterCard, .amex]
}
canMakePayments(usingNetworks:) checked before showing Apple Pay buttonpaymentSummaryItems is the total with merchant display nameNSDecimalNumberPKPaymentAuthorizationController retained while presented and cleared after finishpaymentAuthorizationControllerDidFinish dismisses the controller.pkpass bundlesPKPass(data:) invalid-data and invalid-signature failures surfacedPKPassLibrary.isPassLibraryAvailable() used for pass operations, not add-pass capabilityPKAddPassesViewController.canAddPasses() checked before add-pass UIPKPassLibrary.replacePass(with:) Boolean result checked when replacing a passPKPaymentButton or PayWithApplePayButtonPKAddPassButton, AddPassToWalletButton, or PKAddPassesViewControllerAutomatically organizes invoices and receipts for tax preparation by reading messy files, extracting key information, renaming them consistently, and sorting them into logical folders. Turns hours of manual bookkeeping into minutes of automated organization.
Expert guidance for systematic backtesting of trading strategies. Use when developing, testing, stress-testing, or validating quantitative trading strategies. Covers "beating ideas to death" methodology, parameter robustness testing, slippage modeling, bias prevention, and interpreting backtest results. Applicable when user asks about backtesting, strategy validation, robustness testing, avoiding overfitting, or systematic trading development.
This skill calculates key financial ratios and metrics from financial statement data for investment analysis
This skill provides an advanced financial modeling suite with DCF analysis, sensitivity testing, Monte Carlo simulations, and scenario planning for investment decisions
This skill retrieves upcoming earnings announcements for US stocks using the Financial Modeling Prep (FMP) API. Use this when the user requests earnings calendar data, wants to know which companies are reporting earnings in the upcoming week, or needs a weekly earnings review. The skill focuses on mid-cap and above companies (over $2B market cap) that have significant market impact, organizing the data by date and timing in a clean markdown table format. Supports multiple environments (CLI, Desktop, Web) with flexible API key management.
Crypto wallet operations via the awal CLI — sign in, check balances, send USDC/ETH/POL/SOL, trade tokens, fund the wallet, and use the x402 payment protocol to discover paid services, pay for API calls, monetize an API, or query onchain data. Use whenever the user mentions signing in, login, authentication, wallet status, balance, address, sending money, paying someone, transferring tokens, ENS names, swapping/trading/converting tokens, funding/topping up/onramp, USDC, ETH, POL, SOL, the x402 bazaar, paid APIs, monetizing an endpoint, or querying onchain data on Base.
Access real-time and historical stock market data, forex rates, cryptocurrency prices, commodities, economic indicators, and 50+ technical indicators via the Alpha Vantage API. Use when fetching stock prices (OHLCV), company fundamentals (income statement, balance sheet, cash flow), earnings, options data, market news/sentiment, insider transactions, GDP, CPI, treasury yields, gold/silver/oil prices, Bitcoin/crypto prices, forex exchange rates, or calculating technical indicators (SMA, EMA, MACD, RSI, Bollinger Bands). Requires a free API key from alphavantage.co.
Braintree Automation: manage payment processing via Stripe-compatible tools for customers, subscriptions, payment methods, and transactions
Take dpearson2699/passkit from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.