# StoreKit testing (iOS only)

How to set up StoreKit testing for iOS when using the Flutter SDK.

StoreKit testing in Xcode is a local test environment for testing in-app purchases without requiring a connection to App Store servers. Set up in-app purchases in a local StoreKit configuration file in your Xcode project, or create a synced StoreKit configuration file in Xcode from your in-app purchase settings in App Store Connect. After you enable the configuration file, the test environment uses this local data on your paywalls when your app calls StoreKit APIs.

Add a StoreKit Configuration File [#add-a-storekit-configuration-file]

Go to &#x2A;*File ▸ New ▸ File...** in the menu bar , select **StoreKit Configuration File** and hit **Next**:

<img src="__img0" />

Give it the name **Products**. For a configuration file synced with an app on App Store Connect, select the checkbox, specify your team and app in the drop-down menus that appear, then click **Next**. For a local configuration, leave the checkbox unselected, then click **Next**. Save the file in the top-level folder of your project. You don't need to add it to your target.

Create a New Scheme for StoreKit Testing [#create-a-new-scheme-for-storekit-testing]

It's best practice to create a new scheme in Xcode to be used for StoreKit testing. This allows you to separate out staging and production environments.

Click the scheme in the scheme menu and click &#x2A;*Manage Schemes...**:

<img src="__img1" />

If you haven't already got a Staging scheme, select your current scheme and click **Duplicate**:

<img src="__img2" />

In the scheme editor, add the StoreKit Configuration file to your scheme by clicking on **Run** in the side bar, selecting the **Options** tab and choosing your configuration file in **StoreKit Configuration**. Then, click **Close**:

<img src="__img3" />

You can rename your scheme to &#x2A;*MyAppName (Staging)**.

Setting up the StoreKit Configuration File [#setting-up-the-storekit-configuration-file]

If you've chosen to sync your configuration file with the App Store, your apps will automatically be loaded into your StoreKit Configuration file. When you add new products, just sync again.

If you're using a local configuration, open **Products.storekit*&#x2A;, click the &#x2A;*+** button at the bottom and create a new product. In this tutorial, we'll create an auto-renewable subscription:

<img src="__img4" />

Enter a name for a new subscription group and click **Done**. The subscription group name should match one that is set up for your app in App Store Connect, but it's not a requirement. That means you can test your subscription groups and products in the simulator and then create the products in App Store Connect later:

<img src="__img5" />

Configure the subscription as needed by filling in the **Reference Name**, **Product ID**, **Price**, **Subscription Duration**, and optionally an **Introductory Offer**. Again, this product doesn't have to exist in App Store Connect for you to test purchasing in the simulator. Here is a sample configuration:

<img src="__img6" />

Repeat this for all of your products. When configuring a paywall, the product ID you enter here must match the product ID on the paywall.

You're now all set!

Testing purchases with Transaction Manager [#testing-purchases-with-transaction-manager]

Once you've set up your StoreKit configuration file, you can leverage Xcode's Transaction Manager. Find it under &#x2A;*Debug -> StoreKit -> Manage Transactions...**:

<img src="__img7" />

Use this to quickly test purchasing your products. Once you make a purchase, you can open Transaction Manager to delete it, refund it, request parental approval and much more. Most commonly, you'll probably delete the transaction to reset your subscription state:

<img src="__img8" />

This makes everything a little faster, saving you the trouble of having to delete and reinstall your app to test these states. If you'd like to see a video over how to use it, check this one out:

<iframe width="560" height="315" src="https://www.youtube.com/embed/riL7LYeM0EQ?si=05vmZAR4ZaGLbyJ3" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" referrerpolicy="strict-origin-when-cross-origin" />