Skip to content

Commit 8dbd066

Browse files
Release 3.8.0: applePayStyle + Accelerated Checkouts StoreFront API 2026-04 (#464)
### What changes are you making? Bump to 3.8.0 of swift SDK I noticed we were missing ReadMe documentation for the accelerated checkouts that we have for swift so added some documentation here too 3.8.0 brings two improvements to Accelerated Checkouts 1. adds support for `applePayStyle` closing: #443 https://github.com/user-attachments/assets/c4329ca2-2ea2-4917-b017-61f5faa0d76a 2. Updates the Storefront API for Accelerated Checkouts up to 2026-04 From the Swift PR Shopify/checkout-sheet-kit-swift#555: ``` Bump apiVersion to 2026-04 Add explicit handling for MERCHANDISE_LINE_TRANSFORMERS_RUN_ERROR error code (new in 2026-04) in both CartErrorCode and CartCompletionErrorCode — interrupts with .other reason to fall through to web checkout, matching portable-wallets behavior Add GIFT_CARD_RECIPIENT_INVALID error code (new in 2026-01) to CartErrorCode — interrupts with .unhandled as gift cards are not applicable in the Apple Pay flow No breaking changes affect the kit between 2025-10 and 2026-04. ``` --- ### PR Checklist > [!IMPORTANT] > > - [ ] I've added tests to support my implementation > - [ ] I have read and agree with the [Contribution Guidelines](https://github.com/shopify/checkout-sheet-kit-react-native/blob/main/.github/CONTRIBUTING.md). > - [ ] I have read and agree with the [Code of Conduct](https://github.com/shopify/checkout-sheet-kit-react-native/blob/main/.github/CODE_OF_CONDUCT.md). > - [ ] I've updated the [README](https://github.com/shopify/checkout-sheet-kit-react-native). > > _Releasing a new version of the kit?_ > > - [ ] I have bumped the version number in the [`package.json` file](https://github.com/Shopify/checkout-sheet-kit-react-native/blob/main/modules/%40shopify/checkout-sheet-kit/package.json#L4). --- > [!TIP] > See the [Contributing documentation](https://github.com/shopify/checkout-sheet-kit-react-native/blob/main/.github/CONTRIBUTING.md#releasing-a-new-version) for instructions on how to publish a new version of the library.
1 parent 0ae0c50 commit 8dbd066

13 files changed

Lines changed: 316 additions & 26 deletions

README.md

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,178 @@ shopify.addEventListener('geolocationRequest', async (event: GeolocationRequestE
841841

842842
---
843843

844+
## Accelerated Checkouts
845+
846+
Accelerated checkout buttons surface Apple Pay and Shop Pay options earlier in the buyer journey so more orders complete without leaving your app.
847+
848+
### Prerequisites
849+
850+
- iOS 16 or later
851+
- The `write_cart_wallet_payments` access scope ([request access](https://www.appsheet.com/start/1ff317b6-2da1-4f39-b041-c01cfada6098))
852+
- Apple Pay payment processing certificates ([setup guide](https://shopify.dev/docs/storefronts/mobile/create-apple-payment-processing-certificates))
853+
- A device configured for Apple Pay ([Apple setup instructions](https://developer.apple.com/documentation/passkit/setting-up-apple-pay))
854+
855+
### Configure the integration
856+
857+
Pass an `acceleratedCheckouts` configuration when setting up the provider or `ShopifyCheckoutSheet` instance. This connects the accelerated checkout buttons to your storefront.
858+
859+
```tsx
860+
import {ShopifyCheckoutSheetProvider} from '@shopify/checkout-sheet-kit';
861+
862+
const config = {
863+
acceleratedCheckouts: {
864+
storefrontDomain: 'your-shop.myshopify.com',
865+
storefrontAccessToken: 'your-storefront-access-token',
866+
customer: {
867+
// For authenticated customers
868+
accessToken: 'customer-access-token',
869+
// OR for guest customers
870+
// email: 'customer@example.com',
871+
// phoneNumber: '0123456789',
872+
},
873+
wallets: {
874+
applePay: {
875+
merchantIdentifier: 'merchant.com.yourcompany',
876+
contactFields: ['email', 'phone'],
877+
// Optionally restrict shipping countries (ISO 3166-1 alpha-2)
878+
// supportedShippingCountries: ['US', 'CA'],
879+
},
880+
},
881+
},
882+
};
883+
884+
function App() {
885+
return (
886+
<ShopifyCheckoutSheetProvider configuration={config}>
887+
<YourApp />
888+
</ShopifyCheckoutSheetProvider>
889+
);
890+
}
891+
```
892+
893+
> [!WARNING]
894+
> Do not provide both `accessToken` and `email`/`phoneNumber` together. For authenticated customers, email and phone are fetched automatically from the Shopify account.
895+
896+
### Render accelerated checkout buttons
897+
898+
Use `AcceleratedCheckoutButtons` to attach accelerated checkout calls-to-action to product or cart surfaces once you have a valid cart ID or product variant ID from the Storefront API.
899+
900+
```tsx
901+
import {
902+
AcceleratedCheckoutButtons,
903+
AcceleratedCheckoutWallet,
904+
} from '@shopify/checkout-sheet-kit';
905+
906+
function CartFooter({cartId}: {cartId: string}) {
907+
return (
908+
<AcceleratedCheckoutButtons
909+
cartId={cartId}
910+
wallets={[AcceleratedCheckoutWallet.shopPay, AcceleratedCheckoutWallet.applePay]}
911+
/>
912+
);
913+
}
914+
```
915+
916+
You can also render buttons for a single product variant:
917+
918+
```tsx
919+
<AcceleratedCheckoutButtons
920+
variantId={variantId}
921+
quantity={1}
922+
wallets={[AcceleratedCheckoutWallet.applePay]}
923+
/>
924+
```
925+
926+
#### Customize wallet options
927+
928+
Accelerated checkout buttons display every available wallet by default. Use `wallets` to show a subset or adjust the order.
929+
930+
```tsx
931+
// Display only Shop Pay
932+
<AcceleratedCheckoutButtons
933+
cartId={cartId}
934+
wallets={[AcceleratedCheckoutWallet.shopPay]}
935+
/>
936+
937+
// Display Shop Pay first, then Apple Pay
938+
<AcceleratedCheckoutButtons
939+
cartId={cartId}
940+
wallets={[AcceleratedCheckoutWallet.shopPay, AcceleratedCheckoutWallet.applePay]}
941+
/>
942+
```
943+
944+
#### Modify the Apple Pay button label
945+
946+
Use `applePayLabel` to map to the native `PayWithApplePayButtonLabel` values. The default is `plain`.
947+
948+
```tsx
949+
import {ApplePayLabel} from '@shopify/checkout-sheet-kit';
950+
951+
<AcceleratedCheckoutButtons
952+
cartId={cartId}
953+
applePayLabel={ApplePayLabel.buy}
954+
/>
955+
```
956+
957+
#### Customize the Apple Pay button style
958+
959+
Use `applePayStyle` to set the color style of the Apple Pay button. The default is `automatic`, which adapts to the current appearance (light/dark mode).
960+
961+
```tsx
962+
import {ApplePayStyle} from '@shopify/checkout-sheet-kit';
963+
964+
<AcceleratedCheckoutButtons
965+
cartId={cartId}
966+
applePayStyle={ApplePayStyle.whiteOutline}
967+
/>
968+
```
969+
970+
Available styles: `automatic`, `black`, `white`, `whiteOutline`.
971+
972+
#### Customize button corners
973+
974+
The `cornerRadius` prop lets you match the buttons to other calls-to-action in your app. Buttons default to an 8pt radius.
975+
976+
```tsx
977+
// Pill-shaped buttons
978+
<AcceleratedCheckoutButtons cartId={cartId} cornerRadius={16} />
979+
980+
// Square buttons
981+
<AcceleratedCheckoutButtons cartId={cartId} cornerRadius={0} />
982+
```
983+
984+
### Handle loading, errors, and lifecycle events
985+
986+
Attach lifecycle handlers to respond when buyers finish, cancel, or encounter an error.
987+
988+
```tsx
989+
<AcceleratedCheckoutButtons
990+
cartId={cartId}
991+
onComplete={(event) => {
992+
// Clear cart after successful checkout
993+
clearCart();
994+
}}
995+
onFail={(error) => {
996+
console.error('Accelerated checkout failed:', error);
997+
}}
998+
onCancel={() => {
999+
analytics.track('accelerated_checkout_cancelled');
1000+
}}
1001+
onRenderStateChange={(event) => {
1002+
// event.state: 'loading' | 'rendered' | 'error'
1003+
setRenderState(event.state);
1004+
}}
1005+
onWebPixelEvent={(event) => {
1006+
analytics.track(event);
1007+
}}
1008+
onClickLink={(url) => {
1009+
Linking.openURL(url);
1010+
}}
1011+
/>
1012+
```
1013+
1014+
---
1015+
8441016
## Contributing
8451017

8461018
See the [contributing documentation](CONTRIBUTING.md) for details on how to get started.

modules/@shopify/checkout-sheet-kit/RNShopifyCheckoutSheetKit.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Pod::Spec.new do |s|
2020
s.source_files = "ios/*.{h,m,mm,swift}"
2121

2222
s.dependency "React-Core"
23-
s.dependency "ShopifyCheckoutSheetKit", "~> 3.7.0"
24-
s.dependency "ShopifyCheckoutSheetKit/AcceleratedCheckouts", "~> 3.7.0"
23+
s.dependency "ShopifyCheckoutSheetKit", "~> 3.8.0"
24+
s.dependency "ShopifyCheckoutSheetKit/AcceleratedCheckouts", "~> 3.8.0"
2525

2626
if fabric_enabled
2727
# Use React Native's helper if available, otherwise add dependencies directly

modules/@shopify/checkout-sheet-kit/ios/AcceleratedCheckoutButtons+Extensions.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,23 @@ extension PayWithApplePayButtonLabel {
5858
"topUp": .topUp
5959
]
6060
}
61+
62+
// MARK: - Apple Pay Button Style
63+
64+
@available(iOS 16.0, *)
65+
extension PayWithApplePayButtonStyle {
66+
static func from(_ string: String?, fallback: PayWithApplePayButtonStyle = .automatic) -> PayWithApplePayButtonStyle {
67+
guard let string, let value = map[string] else {
68+
return fallback
69+
}
70+
71+
return value
72+
}
73+
74+
private static let map: [String: PayWithApplePayButtonStyle] = [
75+
"automatic": .automatic,
76+
"black": .black,
77+
"white": .white,
78+
"whiteOutline": .whiteOutline
79+
]
80+
}

modules/@shopify/checkout-sheet-kit/ios/AcceleratedCheckoutButtons.swift

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ class RCTAcceleratedCheckoutButtonsView: UIView {
120120
}
121121
}
122122

123+
@objc var applePayStyle: String? {
124+
didSet {
125+
updateView()
126+
}
127+
}
128+
123129
@objc var onFail: RCTBubblingEventBlock?
124130
@objc var onComplete: RCTBubblingEventBlock?
125131
@objc var onCancel: RCTBubblingEventBlock?
@@ -156,6 +162,17 @@ class RCTAcceleratedCheckoutButtonsView: UIView {
156162
hostingController?.view.frame = bounds
157163
}
158164

165+
// Deprecated in iOS 17 — superseded by registerForTraitChanges in setupView().
166+
// Remove this override when dropping iOS 16 support.
167+
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
168+
super.traitCollectionDidChange(previousTraitCollection)
169+
if #unavailable(iOS 17.0) {
170+
if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
171+
updateView()
172+
}
173+
}
174+
}
175+
159176
override var intrinsicContentSize: CGSize {
160177
let height = calculateRequiredHeight()
161178
return CGSize(width: UIView.noIntrinsicMetric, height: height)
@@ -172,6 +189,14 @@ class RCTAcceleratedCheckoutButtonsView: UIView {
172189

173190
updateView()
174191

192+
// Replaces traitCollectionDidChange for iOS 17+.
193+
// When dropping iOS 16 support, remove the traitCollectionDidChange override above.
194+
if #available(iOS 17.0, *) {
195+
registerForTraitChanges([UITraitUserInterfaceStyle.self]) { [weak self] (_: RCTAcceleratedCheckoutButtonsView, _: UITraitCollection) in
196+
self?.updateView()
197+
}
198+
}
199+
175200
// Listen for configuration updates
176201
NotificationCenter.default.addObserver(
177202
self,
@@ -207,7 +232,7 @@ class RCTAcceleratedCheckoutButtonsView: UIView {
207232
updateView()
208233
}
209234

210-
private func attachModifiers(to buttons: AcceleratedCheckoutButtons, wallets: [Wallet]?, applePayLabel: PayWithApplePayButtonLabel?) -> AcceleratedCheckoutButtons {
235+
private func attachModifiers(to buttons: AcceleratedCheckoutButtons, wallets: [Wallet]?, applePayLabel: PayWithApplePayButtonLabel?, applePayStyle: PayWithApplePayButtonStyle) -> AcceleratedCheckoutButtons {
211236
var modifiedButtons = buttons
212237

213238
if let wallets {
@@ -218,6 +243,8 @@ class RCTAcceleratedCheckoutButtonsView: UIView {
218243
modifiedButtons = modifiedButtons.applePayLabel(applePayLabel)
219244
}
220245

246+
modifiedButtons = modifiedButtons.applePayStyle(applePayStyle)
247+
221248
if let cornerRadius {
222249
modifiedButtons = modifiedButtons.cornerRadius(CGFloat(cornerRadius.doubleValue))
223250
}
@@ -276,18 +303,20 @@ class RCTAcceleratedCheckoutButtonsView: UIView {
276303
return
277304
}
278305

279-
// Attach modifiers (wallets, applePayLabel, cornerRadius)
280-
buttons = attachModifiers(to: buttons, wallets: shopifyWallets, applePayLabel: PayWithApplePayButtonLabel.from(applePayLabel))
306+
// Attach modifiers (wallets, applePayLabel, applePayStyle, cornerRadius)
307+
buttons = attachModifiers(to: buttons, wallets: shopifyWallets, applePayLabel: PayWithApplePayButtonLabel.from(applePayLabel), applePayStyle: PayWithApplePayButtonStyle.from(applePayStyle))
281308
// Attach event handlers
282309
buttons = attachEventListeners(to: buttons)
283310

284311
var view: AnyView
285312

313+
let colorScheme: SwiftUI.ColorScheme = traitCollection.userInterfaceStyle == .dark ? .dark : .light
314+
286315
// Attach config (and Apple Pay config if available)
287316
if let applePayConfig = AcceleratedCheckoutConfiguration.shared.applePayConfiguration {
288-
view = AnyView(buttons.environmentObject(config).environmentObject(applePayConfig))
317+
view = AnyView(buttons.environmentObject(config).environmentObject(applePayConfig).environment(\.colorScheme, colorScheme))
289318
} else {
290-
view = AnyView(buttons.environmentObject(config))
319+
view = AnyView(buttons.environmentObject(config).environment(\.colorScheme, colorScheme))
291320
}
292321

293322
if let hostingController {

modules/@shopify/checkout-sheet-kit/ios/ShopifyCheckoutSheetKit.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ @interface RCT_EXTERN_MODULE (RCTAcceleratedCheckoutButtonsManager, RCTViewManag
106106
*/
107107
RCT_EXPORT_VIEW_PROPERTY(applePayLabel, NSString*)
108108

109+
/**
110+
* Style variant for the Apple Pay button (e.g., "automatic", "black", "white", "whiteOutline").
111+
*/
112+
RCT_EXPORT_VIEW_PROPERTY(applePayStyle, NSString*)
113+
109114
/**
110115
* Emitted when checkout fails. Payload contains a CheckoutException-like shape.
111116
*/

modules/@shopify/checkout-sheet-kit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@shopify/checkout-sheet-kit",
33
"license": "MIT",
4-
"version": "3.7.0",
4+
"version": "3.8.0",
55
"main": "lib/commonjs/index.js",
66
"types": "src/index.ts",
77
"source": "src/index.ts",

modules/@shopify/checkout-sheet-kit/src/components/AcceleratedCheckoutButtons.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ export enum ApplePayLabel {
6161
topUp = 'topUp',
6262
}
6363

64+
export enum ApplePayStyle {
65+
automatic = 'automatic',
66+
black = 'black',
67+
white = 'white',
68+
whiteOutline = 'whiteOutline',
69+
}
70+
6471
type CheckoutIdentifier =
6572
| {
6673
cartId: string;
@@ -87,6 +94,12 @@ interface CommonAcceleratedCheckoutButtonsProps {
8794
*/
8895
applePayLabel?: ApplePayLabel;
8996

97+
/**
98+
* Style for the Apple Pay button color
99+
* Defaults to 'automatic' which adapts to the current appearance (light/dark mode)
100+
*/
101+
applePayStyle?: ApplePayStyle;
102+
90103
/**
91104
* Called when checkout fails
92105
*/
@@ -148,6 +161,7 @@ export type AcceleratedCheckoutButtonsProps = (CartProps | VariantProps) &
148161

149162
interface NativeAcceleratedCheckoutButtonsProps {
150163
applePayLabel?: string;
164+
applePayStyle?: string;
151165
style?: ViewStyle;
152166
checkoutIdentifier: CheckoutIdentifier;
153167
cornerRadius?: number;
@@ -193,6 +207,7 @@ export const AcceleratedCheckoutButtons: React.FC<
193207
AcceleratedCheckoutButtonsProps
194208
> = ({
195209
applePayLabel,
210+
applePayStyle,
196211
cornerRadius,
197212
wallets,
198213
onFail,
@@ -307,6 +322,7 @@ export const AcceleratedCheckoutButtons: React.FC<
307322
return (
308323
<RCTAcceleratedCheckoutButtons
309324
applePayLabel={applePayLabel}
325+
applePayStyle={applePayStyle}
310326
style={{...defaultStyles, height: dynamicHeight}}
311327
checkoutIdentifier={checkoutIdentifier}
312328
cornerRadius={cornerRadius}

modules/@shopify/checkout-sheet-kit/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import {
5858
import {CheckoutErrorCode} from './errors.d';
5959
import type {CheckoutCompletedEvent} from './events.d';
6060
import type {CustomEvent, PixelEvent, StandardEvent} from './pixels.d';
61-
import {ApplePayLabel} from './components/AcceleratedCheckoutButtons';
61+
import {ApplePayLabel, ApplePayStyle} from './components/AcceleratedCheckoutButtons';
6262
import type {
6363
AcceleratedCheckoutButtonsProps,
6464
RenderStateChangeEvent,
@@ -515,6 +515,7 @@ export {
515515
AcceleratedCheckoutWallet,
516516
ApplePayContactField,
517517
ApplePayLabel,
518+
ApplePayStyle,
518519
ColorScheme,
519520
LogLevel,
520521
ShopifyCheckoutSheet,

0 commit comments

Comments
 (0)