iOS Buy SDK integration guide


Shopify's iOS Buy SDK enables merchants to easily sell products in iOS apps and allows their customers to check out using the Shopify Checkout API or Apple Pay.

The iOS Buy SDK is open source. You can download the latest release on GitHub, or install with CocoaPods or Carthage.

Client API

The iOS Buys SDK consists of a framework written in Objective-C, and various sample code. The SDK provides native interfaces to a collection of Shopify web APIs. The SDK provides access to information about the shop, its products, and customer details and orders when a customer is logged in. It also supports creating a cart and performing checkout in a variety of ways. Later sections of this guide describe how to use these features in more detail.

The web API is wrapped by an API client, an instance of the BUYClient class. API requests created by BUYClient class are encapsulated as NSOperation objects, which are scheduled automatically. In most cases, your code can ignore the operation returned from the API client. But if you do keep a reference to the operation, you can cancel it, in cases where you no longer need the results.

Data Model

The SDK defines a data model with native classes for each of the models used by the APIs.

New in version 2, the model is defined using a managed object model file. All model classes are automatically generated from this file. The model file includes additional markup used to support dynamic JSON transformation. These values are stored in the user info dictionaries for the relevant entities and properties.

In the model, all to-many relationships are defined as sets. Some to-many relationships, such as Collection.products and Product.variants, have inherent ordering. In Objective-C, these relationships are represented as ordered sets, instances of NSOrderedSet.


Swift does not support ordered sets. In Swift, ordered to-many relationships are represented with arrays. For Swift, the framework includes conveniences that return an array, such as Product.variantsArray.

Some changes have been made to the semantics for creating model objects, including carts, checkouts, and subsidiary objects. Please see the Migration Guide for more details.