avatarEric Wei

Summary

The website provides a detailed guide on testing In-App-Purchase subscriptions on TestFlight and Sandbox environments, including setting up test users and server notifications, and troubleshooting common issues.

Abstract

The article "Tips to test In-App-Purchase for Subscriptions on TestFlight/Sandbox" offers a comprehensive tutorial for developers to properly test in-app purchase subscriptions. It highlights the complexity of the process, especially due to the lack of documentation on setting up test users on iOS devices. The guide includes steps for creating subscription products, configuring server-to-server notifications, and managing test user accounts. It also addresses specific procedures for iOS versions above 12, such as logging out of production Apple IDs and logging into sandbox accounts. The article emphasizes the differences between testing on Sandbox and TestFlight, noting that TestFlight uses Apple's production backend and allows for careful validation of server notifications. It also points out limitations, such as the inability to test CANCEL or REFUND events, and provides solutions for common problems like the "Cannot connect to iTunes Store" error. The conclusion summarizes key points and reminds developers to log out of production Apple IDs before testing.

Opinions

  • The author believes that testing subscriptions in In-App-Purchase is inherently tricky and that Apple's documentation is lacking in key areas.
  • The article suggests that the process of setting up test users on iOS devices is particularly challenging and undocumented.
  • The author indicates that the distinction between Sandbox and TestFlight environments is significant and can impact the testing experience.
  • The author expresses that certain subscription events, such as cancellations or refunds, cannot be validated in the TestFlight/Sandbox environment, which may be a limitation in the testing process.
  • The author finds the settings for Sandbox and TestFlight testing to be confusing and hopes that the provided tips will make the testing process easier for developers.
  • The author encourages readers to support the article if they find it helpful and promotes their website and social media channels for further engagement.

Tips to test In-App-Purchase for Subscriptions on TestFlight/Sandbox

Testing subscriptions in In-App-Purchase is not an easy task on TestFlight/Sandbox. Because it’s too tricky to make it correct for the first time.

Especially, something important is undocumented on the Apple Developer website regarding how to set up test users properly on iOS devices.

Therefore, I decided to write this tutorial to document my experience and hope the following can help you to smoothly make it work.

Tips to test Subscriptions on Sandbox:

  • Create subscription products on the Apple Developer Website.
  • Setup your server’s URL to receive Apple‘s Server-To-Server Notifications at Apple Developer Website → Apple Store Connect → App Store → General → App Information → General Information → URL for App Store Server Notifications.
  • Create test users on the Apple Developer Website → Apple Store Connect → User and Access → Sandbox → tester
  • For iOS above version 12, you need to log out your production’s Apple ID in settings and log in to the test user in Settings → iTunes and Apple Store → Sandbox Account.
  • Open your app to test In-App-Purchase

Tips to Test Subscriptions on TestFlight:

  • Build and upload your app to Apple Store.
  • Download the TestFlight App.
  • Create subscription products on Apple Developer Website
  • Setup your server’s URL to receive Apple‘s Server-To-Server Notifications at Apple Developer Website → Apple Store Connect → App Store → General → App Information → General Information → URL for App Store Server Notifications.
  • Create test user on Apple Developer Website → Apple Store Connect → TestFlight
  • For iOS above version 12, you need to log out your production’s Apple ID in settings and log in with test users’ Apple ID in Settings → iTunes and Apple Store → Apple ID.
  • Once you log in with the test user, the Sandbox Account shown on the iOS device will be the same as the test user.
  • Download your app via TestFlight and open it to test In-App-Purchase.

Note:

For TestFlight, you may meet a problem as shown below during testing.

“Cannot connect to iTunes Store”

Why?

If you use your production Apple’s ID to test on iPhone, you might meet this problem.

Solution:

  • Log out your production’s Apple ID.
  • Create a new Apple ID as a test user.
  • Log in to your iPhone with this test Apple ID.

Conclusion:

  • The difference between Sandbox and TestFlight is TestFlight could use Apple’s Production/Sandbox backend to test subscriptions. Then you can carefully validate Apple‘s Server-To-Server Notifications for the real situation.
  • You cannot validate the CANCEL or REFUND Notification Event on TestFlight / Sandbox. Apple won't send those events to your backend servers.
  • Testing on Testflight won’t be charged money and the duration of each subscription will be the same with sandbox. This can shorten your testing time.
  • Upgrades/crossgrades don’t work on the sandbox.
  • Remember to test Sandbox and TestFlight, you all need to log out the production’s Apple ID first on IOS devices.
  • For Sandbox, you need to log in test user in Settings → iTunes and Apple Store → Sandbox Account on iOS v12+.
  • While TestFlight, you need to log in test user in Settings → iTunes and Apple Store → Apple ID on iOS v12+.

Those settings are very confusing, aren’t they?

I hope those tips mentioned above can make your life easier.

That’s all, folks. If you liked this story, please show your support by 👏 this story.

Thank you for reading!

Visit us at the website: Game Tech Tutorial

Follow us on Twitter, Facebook, Reddit

You might be interested in

iOS App Development
iOS
iOS Development
iOS Apps
Recommended from ReadMedium