Skip to content

feat: Accelerated Checkouts#230

Merged
markmur merged 6 commits into
mainfrom
feature/accelerated-checkouts
Aug 26, 2025
Merged

feat: Accelerated Checkouts#230
markmur merged 6 commits into
mainfrom
feature/accelerated-checkouts

Conversation

@markmur

@markmur markmur commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

Integration guide

<ShopifyCheckoutSheetProvider
  config={{
      ...checkoutKitConfigDefaults,
+      acceleratedCheckouts: {
+        storefrontDomain: env.STOREFRONT_DOMAIN!,
+        storefrontAccessToken: env.STOREFRONT_ACCESS_TOKEN!,
+        wallets: {
+          applePay: {
+            contactFields: [ApplePayContactField.email, ApplePayContactField.phone],
+            merchantIdentifier: env.STOREFRONT_MERCHANT_IDENTIFIER!,
+          },
+        },
        }
  }}
>
+  <AcceleratedCheckoutButtons
+       applePayLabel={ApplePayLabel.buy}
+       cartId={cartId}
+       cornerRadius={10}
+       wallets={[
+          AcceleratedCheckoutWallet.applePay,
+          AcceleratedCheckoutWallet.shopPay,
+       ]}
+   />
</ShopifyCheckoutSheetProvider>

Not included in this PR

  • Tests for the bridge code - Coming in a fast follow

Manual Testing

iOS

  • AcceleratedCheckoutButtons renders as expected with cartId
  • AcceleratedCheckoutButtons renders as expected with variantId and quantity
  • AcceleratedCheckoutButtons throws in development if variantId is empty or quantity is less than 1
  • AcceleratedCheckoutButtons renders nothing when wallets={[]}
  • AcceleratedCheckoutButtons do not render on iOS devices < 16
  • cornerRadius renders as expected
  • applePayLabel renders as expected
  • All checkout event handlers fire as expected
  • Consumers can integrate without the ShopifyCheckoutSheetProvider context provider

Android

Expectation: Buttons do not show on Android and occupy 0 space.
Catalog Cart
image image

PR Checklist

Important

Tip

See the Contributing documentation for instructions on how to publish a new version of the library.

@markmur markmur force-pushed the feature/accelerated-checkouts branch from 812f820 to 8c61152 Compare August 12, 2025 08:43
@github-actions

github-actions Bot commented Aug 12, 2025

Copy link
Copy Markdown

Coverage Report

Lines Statements Branches Functions
Coverage: 90%
90.81% (178/196) 90.47% (95/105) 85.48% (53/62)

@markmur markmur force-pushed the feature/accelerated-checkouts branch 6 times, most recently from f59f299 to d48d9a7 Compare August 12, 2025 18:33
@markmur markmur changed the base branch from main to sample-improvements August 13, 2025 09:30
@markmur markmur force-pushed the sample-improvements branch from d9a710d to 07e60da Compare August 13, 2025 09:31
@markmur markmur force-pushed the feature/accelerated-checkouts branch 2 times, most recently from fe1e7ce to 8999ab7 Compare August 13, 2025 09:52
@markmur markmur force-pushed the sample-improvements branch from 07e60da to 590f709 Compare August 19, 2025 13:52
@markmur markmur force-pushed the feature/accelerated-checkouts branch 3 times, most recently from 2e8b5bc to ceb880a Compare August 20, 2025 12:36
@markmur markmur force-pushed the sample-improvements branch from 590f709 to c354c9d Compare August 20, 2025 13:35
Base automatically changed from sample-improvements to main August 20, 2025 14:12
@markmur markmur force-pushed the feature/accelerated-checkouts branch 3 times, most recently from 40bdbd7 to 159c224 Compare August 21, 2025 13:38
Comment on lines +1 to +29
BasedOnStyle: LLVM
Language: ObjC
UseTab: Never
IndentWidth: 2
ContinuationIndentWidth: 2
ColumnLimit: 120

# Keep long macro calls (e.g., RCT_EXTERN_METHOD) readable
AlignAfterOpenBracket: DontAlign
BinPackArguments: false
BinPackParameters: false
PenaltyBreakBeforeFirstCallParameter: 200
ReflowComments: false

# Objective-C specifics
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
ObjCBreakBeforeNestedBlockParam: true
PointerAlignment: Left
BreakBeforeBraces: Attach
SpaceBeforeParens: ControlStatements
SortIncludes: false

# Treat common React Native macros as statements for nicer wrapping
StatementMacros:
- RCT_EXTERN_METHOD
- RCT_EXTERN_MODULE
- RCT_EXPORT_VIEW_PROPERTY

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Helps with the formatting of the .mm files

// MARK: - Apple Pay Button

@available(iOS 16.0, *)
extension PayWithApplePayButtonLabel {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The native PayWithApplePayButtonLabel export from PassKit is a struct with static properties. It is unfortunately not an enum which can be initialized from a rawValue

var applePayConfiguration: ShopifyAcceleratedCheckouts.ApplePayConfiguration?

// TODO: Replace this with public defaults from the kit when available
var defaultWallets: [Wallet] = [.applePay, .shopPay]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Need this to be publicly available as a property on the kit before removing here

Comment thread modules/@shopify/checkout-sheet-kit/ios/AcceleratedCheckoutButtons.swift Outdated
Comment on lines +169 to +170
case .error:
return ["state": "error"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TODO: Expose reason here when available (not a blocker for this PR)

Comment on lines +91 to +97
const available = await instance.current?.configureAcceleratedCheckouts(
configuration.acceleratedCheckouts,
);
setAcceleratedCheckoutsAvailable(available);
}

instance.current?.setConfig(configuration);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These configuration calls could potentially be conflated

@markmur markmur force-pushed the feature/accelerated-checkouts branch from c4c9beb to 58413ac Compare August 21, 2025 15:21
@markmur markmur marked this pull request as ready for review August 21, 2025 15:23
@markmur markmur requested a review from a team as a code owner August 21, 2025 15:23
@markmur markmur force-pushed the feature/accelerated-checkouts branch 11 times, most recently from f83bc98 to 7b2228d Compare August 26, 2025 08:36
@markmur markmur force-pushed the feature/accelerated-checkouts branch from 7b2228d to 1947e00 Compare August 26, 2025 08:46
Comment thread modules/@shopify/checkout-sheet-kit/ios/AcceleratedCheckoutButtons.swift Outdated
Comment thread modules/@shopify/checkout-sheet-kit/src/components/AcceleratedCheckoutButtons.tsx Outdated
Comment thread sample/src/hooks/useCheckoutEventHandlers.ts Outdated
Comment thread sample/ios/ReactNative/Info.plist Outdated
Comment thread modules/@shopify/checkout-sheet-kit/ios/ShopifyCheckoutSheetKit.swift Outdated
Comment thread modules/@shopify/checkout-sheet-kit/ios/ShopifyCheckoutSheetKit.swift Outdated
Comment thread modules/@shopify/checkout-sheet-kit/src/context.tsx Outdated
Comment thread modules/@shopify/checkout-sheet-kit/src/index.d.ts
Comment thread modules/@shopify/checkout-sheet-kit/src/index.ts Outdated
@markmur markmur force-pushed the feature/accelerated-checkouts branch 5 times, most recently from f7aedc1 to ce5878a Compare August 26, 2025 11:10
@markmur markmur force-pushed the feature/accelerated-checkouts branch from ce5878a to 6627150 Compare August 26, 2025 11:18
Comment thread sample/src/hooks/useCheckoutEventHandlers.ts Outdated
@markmur markmur force-pushed the feature/accelerated-checkouts branch from 1e4ccf9 to f1ab9f9 Compare August 26, 2025 11:44
@markmur markmur merged commit 4c5b94c into main Aug 26, 2025
8 checks passed
@markmur markmur deleted the feature/accelerated-checkouts branch August 26, 2025 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants