Skip to content

Latest commit

 

History

History
364 lines (351 loc) · 51.9 KB

PassKit.md

File metadata and controls

364 lines (351 loc) · 51.9 KB

PassKit

Symbols: 43.3% of Apple's iOS API (459 of 1059, exact) · Rows: 12: 10 ✅ 1 🟡 1 ❌ · iOS: 6.0+

Area: Commerce & privacy · Apple: PassKit (Apple Pay) · Issues: area:commerce

Apple Pay. Wallet passes (PKPass, PKAddPassesViewController) are on WalletPasses.

How isim implements it

  • Approach: isim's own Swift overlay, isim/swift/overlays/PassKit:

    • the request and payment model (PassKit.swift);
    • the controllers and delegates (PaymentAuthorization.swift);
    • a simulated Apple Pay sheet (PaymentSheet.swift);
    • the buttons (PaymentButton.swift).
  • The sheet is drawn like iOS's. It has:

    • the card;
    • the shipping address, the shipping method and the contact;
    • a coupon code field, and the summary;
    • "Pay with Passcode" (the Simulator's confirmation: there is no side button), then Processing and Done.

    Each row opens its choices. As on iOS:

    • the delegate hears the default card and the shipping address when the sheet appears;
    • before authorization the address is redacted (city, state, postal code, country);
    • its updates refresh the summary;
    • its errors show on their rows, and contact errors disable Pay until another address is chosen.
  • The device's Wallet has four test cards: Visa credit 4242, Mastercard debit 4444, American Express 0005, Discover 1117. It also has two test addresses. ISIM_APPLE_PAY=0 leaves Wallet empty, so canMakePayments() is false (SYSTEM-PROMPTS.md).

  • The token is isim's test token, not Apple's. PKPaymentToken.paymentData is JSON with "version": "isim-test", a note saying what it is, the amount, network and merchant, and the SHA-256 of applicationData. It has no cryptogram or card number, so a payment processor rejects it. Nothing is charged.

  • The buttons have Apple Pay's shapes, colors and labels. The words "Apple Pay" stand where iOS draws Apple's logo: Apple's artwork is not shipped.

  • Objective-C / C interface: #import <PassKit/PassKit.h>, -framework PassKit (#566). The classes are the overlay's under Apple's names and selectors. The networks and contact fields are Apple's NSString constants, and the capabilities and enums are their C types. The delegate protocols are Swift protocols with both forms of each method (completion handler and async), with defaults, so a Swift app implements either. Objective-C sees Apple's @objc protocols: an Objective-C delegate is held weakly through a Swift box, which forwards each method it implements, and the rest keep the Swift defaults.

  • Versus Apple's Simulator: the same flow with test cards; the Simulator's token is also not chargeable.

    • isim does not check the com.apple.developer.in-app-payments entitlement or the merchant identifier.
    • There are no merchant sessions (Apple Pay on the web) or disbursements.

API

API / feature Status iOS Notes
PKPaymentRequest (merchant, country, currency, supportedNetworks, merchantCapabilities, paymentSummaryItems, required billing / shipping contact fields, shippingMethods, shippingType, shippingContactEditingMode, applicationData, couponCode, supportsCouponCode, availableNetworks(), the error helpers) ✅ ≤17 adapted: an incomplete request (no merchant, currency, networks or items) is refused, as on iOS; tested (HelloApplePay, test_apple_pay)
Recurring, deferred and automatic reload payments (PKRecurringPaymentRequest, PKDeferredPaymentRequest, PKAutomaticReloadPaymentRequest, their summary items), multiTokenContexts (PKPaymentTokenContext) 🟡 ≤17 adapted: kept on the request; the sheet shows their summary items
PKPaymentAuthorizationViewController (init?(paymentRequest:), canMakePayments(), canMakePayments(usingNetworks:), canMakePayments(usingNetworks:capabilities:)) and PKPaymentAuthorizationViewControllerDelegate (both forms of each method) ✅ ≤17 adapted: isim's sheet; tested
PKPaymentAuthorizationController (present, dismiss, completion and async) and PKPaymentAuthorizationControllerDelegate (with presentationWindow(for:)) ✅ ≤17 adapted: the sheet over the app's top view controller (or the delegate's window); tested
PKPaymentButton (init(paymentButtonType:paymentButtonStyle:), disableCardArt: forms, cornerRadius), PKPaymentButtonType, PKPaymentButtonStyle ✅ ≤17 adapted: "Apple Pay" in words for the logo; tested
PKPaymentNetwork, PKMerchantCapability, PKContactField, PKShippingType, PKShippingContactEditingMode, PKPaymentMethodType ✅ ≤17 tested
PKPayment, PKPaymentToken, PKPaymentMethod, PKContact ✅ ≤17 adapted: isim's test token (above); the contacts carry the requested fields; tested
PKPaymentSummaryItem, PKShippingMethod, PKDateComponentsRange ✅ ≤17 tested
PKPaymentAuthorizationResult, PKPaymentAuthorizationStatus, the request updates (PKPaymentRequestUpdate, …ShippingContactUpdate, …ShippingMethodUpdate, …PaymentMethodUpdate, …CouponCodeUpdate), PKPaymentError, PKPaymentErrorKey ✅ ≤17 adapted: a failure without errors shows "Payment Not Completed" and Try Again; errors show on their rows; tested
SwiftUI PayWithApplePayButton (action and request forms, with fallbacks), PayWithApplePayButtonLabel, PayWithApplePayButtonStyle, PayWithApplePayButtonPaymentAuthorizationPhase, payWithApplePayButtonStyle(_:), onApplePayShippingContactChange / …ShippingMethodChange / …PaymentMethodChange / …CouponCodeChange ✅ ≤17 adapted: the fallback shows when the device cannot pay; tested
Objective-C: the classes above (+summaryItemWithLabel:amount:, +buttonWithType:style:, -initWithStatus:errors:, …), PKPaymentAuthorizationControllerDelegate / PKPaymentAuthorizationViewControllerDelegate (the handler forms), the PKPaymentNetwork… and PKContactField… constants, PKPaymentErrorDomain and its keys, the enums ✅ ≤17 adapted: an Objective-C delegate goes through a Swift box (above). Tested (PassKitObjCTest, test_passkit_objc: the request and its constants, errors, results and updates, the buttons, a payment through the controller whose delegate changes the shipping total, and one through the view controller)
Merchant sessions (PKPaymentRequestMerchantSessionUpdate, onMerchantSessionRequested), disbursements (PKDisbursementRequest), orderDetails, applePayLaterAvailability, merchantCategoryCode ❌ ≤17 not yet

Not yet in isim

600 symbols Apple documents for iOS that isim does not have (exact; Apple snapshot 2026-10-14). Each links to Apple's documentation.

List