iosin-app-purchasesubscriptionauto-renewing

Does test sandbox autorenew subscriptions IOS?


I've been working on implementing an autorenewing subscription app. I have the actual purchase of the subscription working fine.... I choose the 1 month subscription which should last 3 minutes, before it expires... the initial purchase actually works fine.. but after 3 minutes its expired and I never see the autorenew happen or get a new receipt or anything so the app properly just says.. go away....

The documentation says it should autorenew 5 times before it cancels itself, but I never seem to get a new receipt or anything after the initial purchase.

Is there something/somewhere else I should be looking or checking? Am I missing something?


Solution

  • Sandbox users subscriptions are auto renewed but in a shorter time frames - it will renew every few minutes.

    For the sake of testing, there are some differences in behavior between auto-renewable subscriptions in the production environment and in the test environment.

    Renewal happens at an accelerated rate, and auto-renewable subscriptions renew a maximum of six times per day. This lets you test how your app handles a subscription renewal, a subscription lapse, and a subscription history that includes gaps.

    Taken from apple documentation.

    As for the receipt - you won't get a new one but you should get another transaction under the same receipt for the renewal. The transaction will wait for you in the transaction queue, you should use SKPaymentTransactionObserver to monitor new transactions in the SKPaymentQueue. And if you validate the receipt, you will also see the new transaction with an updated expiration date.

    After a subscription is successfully renewed, Store Kit adds a transaction for the renewal to the transaction queue. Your app checks the transaction queue on launch and handles the renewal the same way as any other transaction. Note that if your app is already running when the subscription renews, the transaction observer is not called; your app finds out about the renewal the next time it’s launched.

    Also from the same documentation.