How to test the "renew" component of auto-renew subscriptions in iOS App Store Sandbox?

esilver picture esilver · Jul 5, 2011 · Viewed 11.6k times · Source

Folks,

I am attempting to verify that auto-renew subscriptions are actually renewing in the sandbox environment. First, it appears that auto-renew subscriptions in sandbox are only valid for 5 minutes. Makes sense. I expect that if I wait for five minutes, then make another call to

https://sandbox.itunes.apple.com/verifyReceipt

With my receipt data, I should see the subscription renewed with an expiry date another five minutes out.

Unfortunately that is not the case. All I see is a response with latest_expired_receipt_info and a status of 21006, which means "This receipt is valid but the subscription has expired" according to the Apple docs.

Can anyone tell me if they are able to test auto-renew subscriptions end-to-end, including this renew component? Or do I have to launch this app and cross my fingers that prod will work as advertised?

Alternatively, is there some sort of client-side magic/API call I have to run prior to re-posting my data to the verifyReceipt URL?

There was some discussion on this topic here, but it's not clear to me if I can/should expect to be able to re-verify subscriptions entirely on the server side by posting to the verifyReceipt URL or if I have to do something on the client side too.

Thanks!

Answer

Ghazanfar Ali picture Ghazanfar Ali · Jun 13, 2012

Copied from the Apple's Developer Forum, for those not willing to goto the forum...

Figured it out (but not thanks to the Apple docs):

1 month subscriptions auto-renew every 5 minutes. So far so good. They auto-renew 5 times and then they stop, so after 25 minutes you'll get the 21006 error. However even when repurchasing the same subscription it will NOT auto-renew again on the same test account since it has already auto-renewed 5 times. So if you want to test renewal and you have been messing with these subscriptions for a while you need to create a new itunes connect test user. This is very annoying honestly and it would be a lot easier if we could just reset the entire purchase history of a test user account. Also putting all in-app test information in the Xcode documentation would be a lot better as opposed to spreading it over Xcode docs/iTunes Connect doc/people figuring stuff out themselves

Hope this helps.