ShopifyCheckoutKit 0.8.1

ShopifyCheckoutKit 0.8.1

Maintained by Shopify.



  • By
  • Shopify Inc.

{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":"Samples","path":"Samples","contentType":"directory"},{"name":"Scripts","path":"Scripts","contentType":"directory"},{"name":"Sources","path":"Sources","contentType":"directory"},{"name":"Tests","path":"Tests","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".ruby-version","path":".ruby-version","contentType":"file"},{"name":".swiftlint.yml","path":".swiftlint.yml","contentType":"file"},{"name":"CHANGELOG.md","path":"CHANGELOG.md","contentType":"file"},{"name":"Gemfile","path":"Gemfile","contentType":"file"},{"name":"Gemfile.lock","path":"Gemfile.lock","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"Package.resolved","path":"Package.resolved","contentType":"file"},{"name":"Package.swift","path":"Package.swift","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"ShopifyCheckoutKit.podspec","path":"ShopifyCheckoutKit.podspec","contentType":"file"}],"totalCount":16}},"fileTreeProcessingTime":1.880794,"foldersToFetch":[],"reducedMotionEnabled":null,"repo":{"id":687512015,"defaultBranch":"main","name":"checkout-kit-swift","ownerLogin":"Shopify","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-09-05T14:03:03.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/8085?v=4","public":true,"private":false,"isOrgOwned":true},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"main","listCacheKey":"v0:1700518320.0","canEdit":false,"refType":"branch","currentOid":"e6fd696197b0fcadec37c4c5447dd60b528e28c1"},"path":"README.md","currentUser":null,"blob":{"rawLines":null,"stylingDirectives":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/Shopify/checkout-kit-swift/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null,"repoAlertsPath":"/Shopify/checkout-kit-swift/security/dependabot","repoSecurityAndAnalysisPath":"/Shopify/checkout-kit-swift/settings/security_analysis","repoOwnerIsOrg":true,"currentUserCanAdminRepo":false},"displayName":"README.md","displayUrl":"https://github.com/Shopify/checkout-kit-swift/blob/main/README.md?raw=true","headerInfo":{"blobSize":"12.2 KB","deleteInfo":{"deleteTooltip":"You must be signed in to make or propose changes"},"editInfo":{"editTooltip":"You must be signed in to make or propose changes"},"ghDesktopPath":"https://desktop.github.com","gitLfsPath":null,"onBranch":true,"shortPath":"d863261","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2FShopify%2Fcheckout-kit-swift%2Fblob%2Fmain%2FREADME.md","isCSV":false,"isRichtext":true,"toc":[{"level":1,"text":"Shopify Checkout Kit - Swift","anchor":"shopify-checkout-kit---swift","htmlText":"Shopify Checkout Kit - Swift"},{"level":3,"text":"Requirements","anchor":"requirements","htmlText":"Requirements"},{"level":3,"text":"Getting Started","anchor":"getting-started","htmlText":"Getting Started"},{"level":4,"text":"Package.swift","anchor":"packageswift","htmlText":"Package.swift"},{"level":4,"text":"Xcode","anchor":"xcode","htmlText":"Xcode"},{"level":4,"text":"Cocoapods","anchor":"cocoapods","htmlText":"Cocoapods"},{"level":3,"text":"Basic Usage","anchor":"basic-usage","htmlText":"Basic Usage"},{"level":3,"text":"Configuration","anchor":"configuration","htmlText":"Configuration"},{"level":4,"text":"colorScheme","anchor":"colorscheme","htmlText":"colorScheme"},{"level":4,"text":"spinnerColor","anchor":"spinnercolor","htmlText":"spinnerColor"},{"level":4,"text":"backgroundColor","anchor":"backgroundcolor","htmlText":"backgroundColor"},{"level":3,"text":"Preloading","anchor":"preloading","htmlText":"Preloading"},{"level":3,"text":"Monitoring the lifecycle of a checkout session","anchor":"monitoring-the-lifecycle-of-a-checkout-session","htmlText":"Monitoring the lifecycle of a checkout session"},{"level":4,"text":"Integrating with Web Pixels, monitoring behavioral data","anchor":"integrating-with-web-pixels-monitoring-behavioral-data","htmlText":"Integrating with Web Pixels, monitoring behavioral data"},{"level":3,"text":"Integrating identity & customer accounts","anchor":"integrating-identity--customer-accounts","htmlText":"Integrating identity & customer accounts"},{"level":4,"text":"Cart: buyer bag, identity, and preferences","anchor":"cart-buyer-bag-identity-and-preferences","htmlText":"Cart: buyer bag, identity, and preferences"},{"level":4,"text":"Multipass","anchor":"multipass","htmlText":"Multipass"},{"level":4,"text":"Shop Pay","anchor":"shop-pay","htmlText":"Shop Pay"},{"level":4,"text":"Customer Account API","anchor":"customer-account-api","htmlText":"Customer Account API"},{"level":3,"text":"Contributing","anchor":"contributing","htmlText":"Contributing"},{"level":3,"text":"License","anchor":"license","htmlText":"License"}],"lineInfo":{"truncatedLoc":"254","truncatedSloc":"173"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplateHelpUrl":"https://docs.github.com/articles/about-issue-and-pull-request-templates","issueTemplate":null,"discussionTemplate":null,"language":"Markdown","languageID":222,"large":false,"loggedIn":false,"newDiscussionPath":"/Shopify/checkout-kit-swift/discussions/new","newIssuePath":"/Shopify/checkout-kit-swift/issues/new","planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/Shopify/checkout-kit-swift/blob/main/README.md","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","dismissStackNoticePath":"/settings/dismiss-notice/publish_stack_from_file","releasePath":"/Shopify/checkout-kit-swift/releases/new?marketplace=true","showPublishActionBanner":false,"showPublishStackBanner":false},"rawBlobUrl":"https://github.com/Shopify/checkout-kit-swift/raw/main/README.md","renderImageOrRaw":false,"richText":"

Shopify Checkout Kit - Swift

\n

\"GitHub \"Swift \"Tests\"

\n

\"image\"

\n

Shopify Checkout Kit is a Swift Package library, part of Shopify's Native SDKs, that enables Swift apps to provide the world’s highest converting, customizable, one-page checkout within the app. The presented experience is a fully-featured checkout that preserves all of the store customizations: Checkout UI extensions, Functions, branding, and more. It also provides platform idiomatic defaults such as support for light and dark mode, and convenient developer APIs to embed, customize, and follow the lifecycle of the checkout experience. Check out our blog to learn how and why we built Checkout Kit.

\n

Requirements

\n
    \n
  • Swift 5.7+
  • \n
  • iOS SDK 13.0+
  • \n
  • The SDK is not compatible with checkout.liquid. The Shopify Store must be migrated for extensibility
  • \n
\n

Getting Started

\n

The SDK is an open-source Swift Package library. As a quick start, see sample projects or use one of the following ways to integrate the SDK into your project:

\n

Package.swift

\n
https://github.com/Shopify/checkout-kit-swift", from: "0.7.0")\n]\">
dependencies: [\n  .package(url: \"https://github.com/Shopify/checkout-kit-swift class=\"pl-pds\">\", from: \"0.7.0\")\n]
\n

Xcode

\n
    \n
  1. Open your Xcode project
  2. \n
  3. Navigate to File > Add Package Dependencies...
  4. \n
  5. Enter https://github.com/Shopify/checkout-kit-swift into the search box
  6. \n¨C50C\n
\n

For more details on managing Swift Package dependencies in Xcode, please see Apple's documentation.

\n

Cocoapods

\n
¨C51C
\n

Basic Usage

\n

Once the SDK has been added as a dependency, you can import the library:

\n
¨C52C
\n

To present a checkout to the buyer, your application must first obtain a checkout URL. The most common way is to use the Storefront GraphQL API to assemble a cart (via ¨C4C and related update mutations) and query the checkoutUrl. You can use any GraphQL client to accomplish this and we recommend Shopify's Mobile Buy SDK for iOS to simplify the development workflow:

\n
¨C53C
\n

The ¨C5C object is a standard web checkout URL that can be opened in any browser. To present a native checkout sheet in your application, provide the ¨C6C alongside optional runtime configuration settings to the ¨C7C function provided by the SDK:

\n
¨C54C
\n

To help optimize and deliver the best experience the SDK also provides a preloading API that can be used to initialize the checkout session in the background and ahead of time.

\n

Configuration

\n

The SDK provides a way to customize the presented checkout experience via the ¨C8C object.

\n

¨C9C

\n

By default, the SDK will match the user's device color appearance. This behavior can be customized via the ¨C10C property:

\n
¨C55C
\n

¨C11C

\n

If the checkout session is not ready and being initialized, a loading spinner is shown and can be customized via the ¨C12C property:

\n
¨C56C
\n

¨C57C

\n

¨C13C

\n

While the checkout session is being initialized, the background color of the view can be customized via the ¨C14C property:

\n
¨C58C
\n

Preloading

\n

Initializing a checkout session requires communicating with Shopify servers and, depending on the network weather and the quality of the buyer's connection, can result in undesirable waiting time for the buyer. To help optimize and deliver the best experience, the SDK provides a preloading hint that allows app developers to signal and initialize the checkout session in the background and ahead of time.

\n

Preloading is an advanced feature that can be disabled via a runtime flag:

\n
¨C59C
\n

Once enabled, preloading a checkout is as simple as:

\n
¨C60C
\n

¨C61C

\n
    \n¨C62C\n¨C63C\n¨C64C\n
\n

Monitoring the lifecycle of a checkout session

\n

You can use the ¨C20C protocol to register callbacks for key lifecycle events during the checkout session:

\n
¨C65C
\n

Integrating with Web Pixels, monitoring behavioral data

\n

App developers can use lifecycle events to monitor and log the status of a checkout session. Web Pixel events are currently not executed within rendered checkout. Support for customer events and behavioral analytics is under development and will be available prior to the general availability of SDK.

\n

Integrating identity & customer accounts

\n

Buyer-aware checkout experience reduces friction and increases conversion. Depending on the context of the buyer (guest or signed-in), knowledge of buyer preferences, or account/identity system, the application can use one of the following methods to initialize a personalized and contextualized buyer experience.

\n

Cart: buyer bag, identity, and preferences

\n

In addition to specifying the line items, the Cart can include buyer identity (name, email, address, etc.), and delivery and payment preferences: see guide. Included information will be used to present pre-filled and pre-selected choices to the buyer within checkout.

\n

Multipass

\n

Shopify Plus merchants using Classic Customer Accounts can use Multipass (API documentation) to integrate an external identity system and initialize a buyer-aware checkout session.

\n
¨C66C
\n
    \n¨C67C\n¨C68C\n
\n

¨C69C

\n

Shop Pay

\n

To initialize accelerated Shop Pay checkout, the cart can set a walletPreference to 'shop_pay'. The sign-in state of the buyer is app-local. The buyer will be prompted to sign in to their Shop account on their first checkout, and their sign-in state will be remembered for future checkout sessions.

\n

Customer Account API

\n

We are working on a library to provide buyer sign-in and authentication powered by the new Customer Account API—stay tuned.

\n
\n

Contributing

\n

We welcome code contributions, feature requests, and reporting of issues. Please see guidelines and instructions.

\n

License

\n

Checkout Kit is provided under an MIT License.

\n
","renderedFileInfo":null,"shortPath":null,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"repoOwner":"Shopify","repoName":"checkout-kit-swift","showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","showDependabotConfigurationBanner":false,"actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timedOut":false,"notAnalyzed":false,"symbols":[{"name":"Shopify Checkout Kit - Swift","kind":"section_1","identStart":2,"identEnd":30,"extentStart":0,"extentEnd":12453,"fullyQualifiedName":"Shopify Checkout Kit - Swift","identUtf16":{"start":{"lineNumber":0,"utf16Col":2},"end":{"lineNumber":0,"utf16Col":30}},"extentUtf16":{"start":{"lineNumber":0,"utf16Col":0},"end":{"lineNumber":254,"utf16Col":0}}},{"name":"Requirements","kind":"section_3","identStart":1321,"identEnd":1333,"extentStart":1317,"extentEnd":1468,"fullyQualifiedName":"Requirements","identUtf16":{"start":{"lineNumber":8,"utf16Col":4},"end":{"lineNumber":8,"utf16Col":16}},"extentUtf16":{"start":{"lineNumber":8,"utf16Col":0},"end":{"lineNumber":14,"utf16Col":0}}},{"name":"Getting Started","kind":"section_3","identStart":1472,"identEnd":1487,"extentStart":1468,"extentEnd":2295,"fullyQualifiedName":"Getting Started","identUtf16":{"start":{"lineNumber":14,"utf16Col":4},"end":{"lineNumber":14,"utf16Col":19}},"extentUtf16":{"start":{"lineNumber":14,"utf16Col":0},"end":{"lineNumber":41,"utf16Col":0}}},{"name":"Package.swift","kind":"section_4","identStart":1718,"identEnd":1731,"extentStart":1713,"extentEnd":1845,"fullyQualifiedName":"Package.swift","identUtf16":{"start":{"lineNumber":18,"utf16Col":5},"end":{"lineNumber":18,"utf16Col":18}},"extentUtf16":{"start":{"lineNumber":18,"utf16Col":0},"end":{"lineNumber":26,"utf16Col":0}}},{"name":"Xcode","kind":"section_4","identStart":1850,"identEnd":1855,"extentStart":1845,"extentEnd":2231,"fullyQualifiedName":"Xcode","identUtf16":{"start":{"lineNumber":26,"utf16Col":5},"end":{"lineNumber":26,"utf16Col":10}},"extentUtf16":{"start":{"lineNumber":26,"utf16Col":0},"end":{"lineNumber":35,"utf16Col":0}}},{"name":"Cocoapods","kind":"section_4","identStart":2236,"identEnd":2245,"extentStart":2231,"extentEnd":2295,"fullyQualifiedName":"Cocoapods","identUtf16":{"start":{"lineNumber":35,"utf16Col":5},"end":{"lineNumber":35,"utf16Col":14}},"extentUtf16":{"start":{"lineNumber":35,"utf16Col":0},"end":{"lineNumber":41,"utf16Col":0}}},{"name":"Basic Usage","kind":"section_3","identStart":2299,"identEnd":2310,"extentStart":2295,"extentEnd":4068,"fullyQualifiedName":"Basic Usage","identUtf16":{"start":{"lineNumber":41,"utf16Col":4},"end":{"lineNumber":41,"utf16Col":15}},"extentUtf16":{"start":{"lineNumber":41,"utf16Col":0},"end":{"lineNumber":87,"utf16Col":0}}},{"name":"Configuration","kind":"section_3","identStart":4072,"identEnd":4085,"extentStart":4068,"extentEnd":5705,"fullyQualifiedName":"Configuration","identUtf16":{"start":{"lineNumber":87,"utf16Col":4},"end":{"lineNumber":87,"utf16Col":17}},"extentUtf16":{"start":{"lineNumber":87,"utf16Col":0},"end":{"lineNumber":135,"utf16Col":0}}},{"name":"colorScheme","kind":"section_4","identStart":4214,"identEnd":4227,"extentStart":4209,"extentEnd":4837,"fullyQualifiedName":"colorScheme","identUtf16":{"start":{"lineNumber":91,"utf16Col":5},"end":{"lineNumber":91,"utf16Col":18}},"extentUtf16":{"start":{"lineNumber":91,"utf16Col":0},"end":{"lineNumber":109,"utf16Col":0}}},{"name":"spinnerColor","kind":"section_4","identStart":4842,"identEnd":4856,"extentStart":4837,"extentEnd":5305,"fullyQualifiedName":"spinnerColor","identUtf16":{"start":{"lineNumber":109,"utf16Col":5},"end":{"lineNumber":109,"utf16Col":19}},"extentUtf16":{"start":{"lineNumber":109,"utf16Col":0},"end":{"lineNumber":123,"utf16Col":0}}},{"name":"backgroundColor","kind":"section_4","identStart":5310,"identEnd":5327,"extentStart":5305,"extentEnd":5705,"fullyQualifiedName":"backgroundColor","identUtf16":{"start":{"lineNumber":123,"utf16Col":5},"end":{"lineNumber":123,"utf16Col":22}},"extentUtf16":{"start":{"lineNumber":123,"utf16Col":0},"end":{"lineNumber":135,"utf16Col":0}}},{"name":"Preloading","kind":"section_3","identStart":5709,"identEnd":5719,"extentStart":5705,"extentEnd":7292,"fullyQualifiedName":"Preloading","identUtf16":{"start":{"lineNumber":135,"utf16Col":4},"end":{"lineNumber":135,"utf16Col":14}},"extentUtf16":{"start":{"lineNumber":135,"utf16Col":0},"end":{"lineNumber":159,"utf16Col":0}}},{"name":"Monitoring the lifecycle of a checkout session","kind":"section_3","identStart":7296,"identEnd":7342,"extentStart":7292,"extentEnd":9639,"fullyQualifiedName":"Monitoring the lifecycle of a checkout session","identUtf16":{"start":{"lineNumber":159,"utf16Col":4},"end":{"lineNumber":159,"utf16Col":50}},"extentUtf16":{"start":{"lineNumber":159,"utf16Col":0},"end":{"lineNumber":210,"utf16Col":0}}},{"name":"Integrating with Web Pixels, monitoring behavioral data","kind":"section_4","identStart":9229,"identEnd":9284,"extentStart":9224,"extentEnd":9639,"fullyQualifiedName":"Integrating with Web Pixels, monitoring behavioral data","identUtf16":{"start":{"lineNumber":206,"utf16Col":5},"end":{"lineNumber":206,"utf16Col":60}},"extentUtf16":{"start":{"lineNumber":206,"utf16Col":0},"end":{"lineNumber":210,"utf16Col":0}}},{"name":"Integrating identity & customer accounts","kind":"section_3","identStart":9643,"identEnd":9683,"extentStart":9639,"extentEnd":12222,"fullyQualifiedName":"Integrating identity & customer accounts","identUtf16":{"start":{"lineNumber":210,"utf16Col":4},"end":{"lineNumber":210,"utf16Col":44}},"extentUtf16":{"start":{"lineNumber":210,"utf16Col":0},"end":{"lineNumber":247,"utf16Col":0}}},{"name":"Cart: buyer bag, identity, and preferences","kind":"section_4","identStart":10005,"identEnd":10047,"extentStart":10000,"extentEnd":10419,"fullyQualifiedName":"Cart: buyer bag, identity, and preferences","identUtf16":{"start":{"lineNumber":214,"utf16Col":5},"end":{"lineNumber":214,"utf16Col":47}},"extentUtf16":{"start":{"lineNumber":214,"utf16Col":0},"end":{"lineNumber":218,"utf16Col":0}}},{"name":"Multipass","kind":"section_4","identStart":10424,"identEnd":10433,"extentStart":10419,"extentEnd":11523,"fullyQualifiedName":"Multipass","identUtf16":{"start":{"lineNumber":218,"utf16Col":5},"end":{"lineNumber":218,"utf16Col":14}},"extentUtf16":{"start":{"lineNumber":218,"utf16Col":0},"end":{"lineNumber":237,"utf16Col":0}}},{"name":"Shop Pay","kind":"section_4","identStart":11528,"identEnd":11536,"extentStart":11523,"extentEnd":11969,"fullyQualifiedName":"Shop Pay","identUtf16":{"start":{"lineNumber":237,"utf16Col":5},"end":{"lineNumber":237,"utf16Col":13}},"extentUtf16":{"start":{"lineNumber":237,"utf16Col":0},"end":{"lineNumber":241,"utf16Col":0}}},{"name":"Customer Account API","kind":"section_4","identStart":11974,"identEnd":11994,"extentStart":11969,"extentEnd":12222,"fullyQualifiedName":"Customer Account API","identUtf16":{"start":{"lineNumber":241,"utf16Col":5},"end":{"lineNumber":241,"utf16Col":25}},"extentUtf16":{"start":{"lineNumber":241,"utf16Col":0},"end":{"lineNumber":247,"utf16Col":0}}},{"name":"Contributing","kind":"section_3","identStart":12226,"identEnd":12238,"extentStart":12222,"extentEnd":12382,"fullyQualifiedName":"Contributing","identUtf16":{"start":{"lineNumber":247,"utf16Col":4},"end":{"lineNumber":247,"utf16Col":16}},"extentUtf16":{"start":{"lineNumber":247,"utf16Col":0},"end":{"lineNumber":251,"utf16Col":0}}},{"name":"License","kind":"section_3","identStart":12386,"identEnd":12393,"extentStart":12382,"extentEnd":12453,"fullyQualifiedName":"License","identUtf16":{"start":{"lineNumber":251,"utf16Col":4},"end":{"lineNumber":251,"utf16Col":11}},"extentUtf16":{"start":{"lineNumber":251,"utf16Col":0},"end":{"lineNumber":254,"utf16Col":0}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"csrf_tokens":{"/Shopify/checkout-kit-swift/branches":{"post":"7SajLe_225Ki8yS4Qg4UUV_xJtM_HoD3g__31vP-Zg5S81mc4DbXKAnLAcwf0g9ls-X80la4zcgtRzYNDzv3gQ"},"/repos/preferences":{"post":"0DF0SZt058QTbNZNW-Ej5bIfQt-2OmBe5mp6_Pgak7pbolsMAV2E5vn4kWyD3jZA2wEGHYVL5kpnWOBmLGj7eg"}}},"title":"checkout-kit-swift/README.md at main · Shopify/checkout-kit-swift"}