Skip to main content
Answer

How to change app to unsubscribed state in sanbox testing?

  • March 17, 2024
  • 1 reply
  • 474 views

Forum|alt.badge.img+3

From the The ultimate guide to iOS subscription testing I found this approach to test subscription restore:

One big caveat with iOS testing in the sandbox environment is that there is no receipt file on the device until a purchase is made. This differs from the production sandbox and production environments, where a receipt file is generated at the time of installation. To fully test restoring a purchase in the sandbox, you need to add a button, gesture, or some other means to revert the app to the unsubscribed state.

  1. Sign up for a monthly subscription.
  2. Use a button or gesture to revert the app to the unsubscribed state.
  3. Tap the Restore Purchases button.
  4. If you do this before the 35-minute subscription cycle is over, an active subscription should be found, and the app should change to the subscribed state.

 

Question is, how do I perform step 2? Is there any API call I can make to do that?

Best answer by Ryan Glanz

Hi,

The simplest way to do that is to call the login method and log in with a different appUserId. You should then be missing the entitlement until you press restore purchases.

This post has been closed for comments

1 reply

Ryan Glanz
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • Answer
  • March 20, 2024

Hi,

The simplest way to do that is to call the login method and log in with a different appUserId. You should then be missing the entitlement until you press restore purchases.