- Remove redundant code
- Ignore "about:blank" URLs
- Ignore cancelled redirects
- Call
checkoutDidClickLink
for deep links - Prevent "recovery" retry flow for multipass URLs with one-time tokens
- Expose
invalidate()
function to manually clear the webview (preload) cache
- Updates to reflect latest Web Pixel schema
- Fixes internal instrumentation
- Sets
allowsInlineMediaPlayback
to true on the Webview to prevent the iOS camera opening as a live broadcast.
- Fixes an issue where web pixels events do not fire after checkout completion.
Version 3.0.0
of the Checkout Sheet Kit ships with numerous improvements to error handling, including graceful degradation. In the event that your app receives an HTTP error on load or crashes mid-experience, the kit will implement a retry in an effort to attempt to recover.
func checkoutDidFail(error: ShopifyCheckoutSheetKit.CheckoutError) {
var errorMessage: String = ""
/// Internal Checkout SDK error
if case .sdkError(let underlying, let recoverable) = error {
errorMessage = "\(underlying.localizedDescription)"
}
/// Checkout unavailable error
if case .checkoutUnavailable(let message, let code, let recoverable) = error {
errorMessage = message
switch code {
case .clientError(let clientErrorCode):
errorMessage = "Client Error: \(clientErrorCode)"
case .httpError(let statusCode):
errorMessage = "HTTP Error: \(statusCode)"
}
}
/// Storefront configuration error
if case .configurationError(let message, let code, let recoverable) = error {
errorMessage = message
}
/// Checkout has expired, re-create cart to fetch a new checkout URL
if case .checkoutExpired(let message, let code, let recoverable) = error {
errorMessage = message
}
if !error.isRecoverable {
handleUnrecoverableError(errorMessage)
}
}
To opt out of the recovery feature, or to opt-out of the recovery of a specific error, extend the shouldRecoverFromError
delegate method:
class Controller: CheckoutDelegate {
shouldRecoverFromError(error: CheckoutError) {
// default:
return error.isRecoverable
}
checkoutDidFail(error: CheckoutError) {
// Error handling...
}
}
In the event that the Checkout Sheet Kit has triggered the recovery experience, certain features may not be available.
- Theming may not work as intended.
- Web pixel lifecycle events will not fire.
checkoutDidComplete
lifecycle events will contain only anorderId
.
- Makes
CheckoutCompletedEvent
encodable/decodable.
- The loading spinner has been replaced by a progress bar on the webview. This will result in a faster perceived load time for checkout because the SDK will no longer wait for full page load to show the DOM content.
- Localization has been added for the sheet title. Customize this value by modifying a
shopify_checkout_sheet_title
string in yourLocalizable.xcstrings
file.
{
"sourceLanguage": "en",
"strings": {
"shopify_checkout_sheet_title": {
"comment": "The title of the checkout sheet.",
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Checkout"
}
}
}
}
}
}
- The
checkoutDidComplete
delegate method now returns a completed event object, containing details about the order:
checkoutDidComplete(event: ShopifyCheckoutSheetKit.CheckoutCompletedEvent) {
print(event.orderDetails.id)
}
spinnerColor
has been replaced bytintColor
:
- ShopifyCheckoutSheetKit.configuration.spinnerColor = .systemBlue
+ ShopifyCheckoutSheetKit.configuration.tintColor = .systemBlue
CheckoutViewController.Representable()
for SwiftUI has been deprecated. Please useCheckoutSheet(checkout:)
now instead.
.sheet(isPresented: $isShowingCheckout, onDismiss: didDismiss) {
- CheckoutViewController.Representable(checkout: $checkoutURL, delegate: eventHandler)
- .onReceive(eventHandler.$didCancel, perform: { didCancel in
- if didCancel {
- isShowingCheckout = false
- }
- })
+ CheckoutSheet(checkout: $checkoutURL)
+ .title("Custom title")
+ .colorScheme(.automatic)
+ .backgroundColor(.black)
+ .tintColor(.systemBlue)
+ .onCancel {
+ isShowingCheckout = false
+ }
+ .onComplete { }
+ .onPixelEvent { }
+ .onFail { }
+ .onLinkClick { }
}
Fixes an issue with strongly held references to old Webview instances.
Bumps the package version.
ShopifyCheckoutSheetKit is now generally available for Swift, Android and React Native - providing the world's highest converting, customizable, one-page checkout.
- Clean Web Pixel types - #120 (@markmur)
- Expose Web Pixel events via new
checkoutDidEmitWebPixelEvent
hook - #101, #103, #105, #107, #112 (@josemiguel-alvarez, @kiftio , @markmur) - Send
Sec-Purpose: prefetch
header to identify preload requests - #109 (@kiftio) - Improve caching of preloaded checkout views - #97, #102, #110 (@cianBuckley)
- Improve UX for loading spinner - #111 (@markmur)
- Breaking: The Shopify Checkout Kit has been rebranded to the Shopify Checkout Sheet Kit for Swift. To match this new name, the package has been renamed to
ShopifyCheckoutSheetKit
.
Emit a presented message to checkout when the checkout sheet is raised as groundwork for supporting analytics / pixel events.
- Adds support for SwiftUI
- `CheckoutViewController`` is now public for SwiftUI compatibility and to support UI modification requests
- Telemetry improvements
- Improved documentation
- Adds support for CocoaPods.
- Breaking: The Mobile Checkout SDK has been rebranded to the Shopify Checkout Kit for Swift. To match this new name, the package has been renamed to
ShopifyCheckoutKit
.