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 If you found this article helpful, please follow us on Facebook to get the latest tutorials in the future.
Thank you for reading!