Skip to content

[Swift] Report Apple Pay sheet presentation failures through onFail - #930

Merged
kyle-schellen merged 1 commit into
mainfrom
ks-apple-pay-present-failure
Oct 8, 2026
Merged

kyle-schellen merged 1 commit into
mainfrom
ks-apple-pay-present-failure

Conversation

@kyle-schellen

@kyle-schellen kyle-schellen commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What changes are you making?

When PKPaymentAuthorizationController.present() returns false, startPaymentRequest() reset to .idle without throwing. As a result, onFail never fired, and apps that show a loading state on tap stayed stuck. It now throws .invariant(expected: "payment sheet") after the reset, and onPress() forwards it to onFail as .sdkError. This is the same fix as v3's Shopify/checkout-sheet-kit-swift#609.

Reported in Shopify/checkout-sheet-kit-swift#599 (shop/issues-checkout#14687).

How to test

  • dev swift test ApplePayAuthorizationDelegateTests
  • Manual: point the Swift sample at a store with no accepted card brands, then tap Apple Pay on a product. PassKit rejects the empty supportedNetworks, so present() returns false.

Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

@github-actions github-actions Bot added the #gsd:50662 Rebase Checkout Kit on UCP label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Bundle Size Budgets

Budget Size Limits Result
— — — ➖ No configured budgets affected

Bundle and package size

Web bundle sizes cover shipped runtime JavaScript. Package sizes cover the full published archive, including any source maps, declarations, and documentation it contains.

Platform Measurement Compression Base Head Delta
- - - - - -
How sizes are measured

Measured from the PR base SHA and PR head SHA. Web bundle rows sum shipped .js, .mjs, and .cjs files under dist/, excluding source maps and declarations. The gzip bundle size sums files compressed individually with gzip -n -9. npm package sizes are gzip-compressed .tgz archives; Android AAR sizes are ZIP archives. Package sizes are not final app binary sizes.

@kyle-schellen kyle-schellen self-assigned this Oct 7, 2026
When PKPaymentAuthorizationController.present() returned false,
startPaymentRequest() reset the state machine to idle without raising an
error, so ApplePayViewController.onPress() never called onCheckoutFail and
host apps that show a loading state on tap stayed stuck.

Reset to idle as before, then throw
ShopifyAcceleratedCheckouts.Error.invariant(expected: "payment sheet"),
matching the v3 fix (Shopify/checkout-sheet-kit-swift#609). The existing
onPress() catch forwards it to onCheckoutFail as an sdkError.

Reported in Shopify/checkout-sheet-kit-swift#599 (shop/issues-checkout#14687).
@kyle-schellen
kyle-schellen force-pushed the ks-apple-pay-present-failure branch from d5add8f to 83d97fa Compare October 7, 2026 22:29
@kyle-schellen
kyle-schellen marked this pull request as ready for review October 7, 2026 23:15
@kyle-schellen
kyle-schellen requested a review from a team as a code owner October 7, 2026 23:15
@bitrise

bitrise Bot commented Oct 7, 2026

Copy link
Copy Markdown

Bitrise builds

E2E · iOS CI

Install this build

Open Tophat, select your target device, then click Install. Links open on the Mac running Tophat.

SDK Install
Swift Install with Tophat

Checkout Kit E2E results

Status Tags Target Platform OS version tag Device
✅ launch, checkout-presentation, checkout-completion, buyer-identity, preload swift ios latest iPhone 15
iOS 27 Beta

@markmur markmur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Kyle!

@kyle-schellen
kyle-schellen merged commit 21edead into main Oct 8, 2026
49 checks passed
@kyle-schellen
kyle-schellen deleted the ks-apple-pay-present-failure branch October 8, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants