iOS Restore Purchases in TestFlight

2019-07-26 14:01发布

I have a mobile app, which for iOS I am testing with TestFlight.

After I make a successful "Non-Renewing Subscription" purchase, I would expect to see the purchase history when I call Restore Purchases. When I make a purchase through the TestFlight app, I do not see any historic purchases.

Question

Is this normal behaviour because this is a test environment, and the purchases don't really exist? Or, should I expect to see the historic purchases?

If one cannot see the historic purchases, how do you test Restore Purchases?

Code:

  this.iap.restorePurchases().then((purchases: any[]) => {
      // purchases are empty
  });

The get Products does return the products successfully.

  this.iap.getProducts(this.PRODUCT_IDS).then((products: any[]) => {
     ...
  });

ps. When I run this same code in Android restorePurchases does return the historic purchases.

1条回答
萌系小妹纸
2楼-- · 2019-07-26 14:54

If you refer to table 1-2 and the accompanying text in the In App Purchase Programming Guide you will see that non-renewable subscriptions are not restored by the system; it is your app's responsibility to track the user's subscription status on your own server.

  • Non-renewable subscriptions. Subscriptions that don’t involve delivering episodic content. Examples include access to a database of historic photos or a collection of flight maps. It’s your app’s responsibility to make the subscription available on all of the user’s devices and to let users restore the purchase. This product type is often used when your users already have an account on your server that you can use to identify them when restoring content. Expiration and the duration of the subscription are also left to your app (or your server) to implement and enforce.

Accordingly you will not see a non-renewing subscription in the restored purchases, so what you are seeing is expected both in test and production.

Auto renewing subscriptions are restorable since Apple's server is tracking the active subscription for you.

查看更多
登录 后发表回答