How to simulate billing issue and cancel subscription in sandbox environment

Dear Supporters,


I'm implementing auto-renew subscription in my application, and be able to test it behavior flow in sandbox environment, but i cannot test specific cases such as billing issue, cancel subscription in sandbox environment. You please give me advice how to simulate these cases.


Thanks in advance,

David Tong

Replies

Hard code a fake "cancellation_date" into the receipt and see how your app responds if a receipt had such a field.


But better - ignore the problem, it rarely happens and when it does the user most likely is no longer using the app.

Thanks for your information, but there is no way to simulate these scenarios right? I also want to check transaction to know exactly what apple charge how i check it in sandbox? as far i know we can check transactions information in Itune Connect if app already published app store.

What scenarios? I am answered for the scenario in which a user cancels their purchase.


> exactly what apple charge - you can't know that.

Thank you. I got your answer, but i concerns when we add 'cancellation_date' into the receipt, as far as i know we can test maxium of 6 times for an auto-subscription for specific sandbox account, then the account expired date.

Yes, a single test user will get only 5 auto renewals from a subscription and then autorenewing will stop. I believe they are, or have modified the system so that a test user can be retried - a new purchase by a test user may result in another 5 additional auto renewals.


What I was suggesting was adding to your code running from Xcode something like a big button and a BOOL variable called "fakeCancellation". If the user taps that big button then fakeCancellation is set to YES. When the code searches the receipt for the cancellation_date field iand does not find it, it checks the value of fakeCancellation. If it is YES then it pretends it found that field with yesterday's date.