What’s new in Apphud: SplitMetrics Acquire Integration, Experiments Improvements, SDK UpdatesLet’s see
Why Apphud?PricingContact
March 26, 2021
3 min read

Testing purchases using Local StoreKit Configuration File

That means you can test your In-App Purchases in iOS Simulator using Apphud SDK just like in Sandbox.

Testing purchases using Local StoreKit Configuration File

These kind of receipts are not being validated through the Apple verification server and are being validated locally.

Note: we don't validate local receipts with StoreKit certificate at the moment (you can test without them, everything works fine). The certificate is required for testing automation scenarios, this will be added later.


  • Easily test in-app purchases in Simulator, including introductory or promotional offers.
  • Test interruptions, like asking to buy. In this case, a transaction will fail, but in the transaction manager developer is able to resolve it. When the payment issue is resolved, a new transaction is created.
  • Cancel renewals, refund transactions, etc.
  • Manage transactions, change accelerated time rate, change storefront, etc.

Let's discuss more closely.

StoreKit Configuration File

In Xcode 12 you can create a StoreKit Configuration File in order to create and test in-app purchases without having to create them in App Store Connect.

StoreKit Configuration File In Xcode 12StoreKit Configuration File In Xcode 12

This is basically a JSON-encoded file that describes a struct of your test in-app purchases. Product Identifiers doesn't have to be the same as in App Store Connect, however, we recommend creating exactly the same to avoid possible bugs in your logic.

Create Product IdentifiersCreate Product Identifiers

Adding in-app purchases is pretty straightforward. You can easily create and update introductory offers or promotional offers.

Once product identifiers set up, you will need to include the given configuration file to the build scheme.

Go to Product > Scheme > Edit Scheme and in Run/Debug tab under Options choose your StoreKit configuration file.

Choose StoreKit configuration file in Run/DebugChoose StoreKit configuration file in Run/Debug

Make Purchases in Simulator

With the StoreKit Configuration file set up, you can make purchases in Simulator as usual by calling Apphud.purchase(product){..} method.

Purchases in SimulatorPurchases in Simulator

After the purchase is completed, a receipt is sent to Apphud servers and decoded locally. No HTTP request is sent to Apple, a receipt is being decoded as PKCS#7 container.

Validating local receipts in Apphud

Apphud now finally supports receipts made using Local StoreKit. No need to update SDK, everything is done on our backend.

However, there are some limitations mentioned below. 


  • The receipt generated by Local StoreKit is limited and doesn't contain many fields that are available when verifying receipts through Apple. For example, missing trial period field. That means after purchasing a subscription with a trial period enabled, you will get ApphudSubscripton model with regular status in response. But don't worry, that is only LocalStoreKit's receipt issue, everything will work fine in production!
  • No access pending_renewal_info, a special sub-JSON, which contains important fields about the state of subscriptions, like autorenewal state, in billing retry state, etc. Subscriptions generated from local receipts will always have isInRetryBilling = false and isAutorenewEnabled = true.
  • A local receipt is just a snapshot and we are unable to detect renewals of such receipts until a fresh local receipt is sent to our backend. This means that the subscription will move to an expired state after the first transaction is expired. When launching the app again in Simulator, a new receipt will be automatically sent to Apphud, and subscription data will be updated. No actions required on the developer side. Again, everything will work just fine in production.
  • Apphud doesn't create transactions and events of local receipts. On Apphud User page, the subscription will have just status and expiration date:
Status and expiration date of the subscriptionStatus and expiration date of the subscription
  • Testing promotional offers using Local StoreKit will be supported soon.

To summarize, in this article, we covered how you can easily test your In-App Purchases in Simulator using Apphud SDK thanks to Local StoreKit from Apple. Hope you will like this feature and debugging process become simpler. Have a great day!

Co-founder at Apphud
Ex iOS app and game developer. 11 years in the industry since iOS 3. More than 50 apps are in the background with 4 exits. Entrepreneur and traveler.