Initial Purchase:
- User selects a product loaded into our store. this is added to the transaction observer’s payment queue.
- StoreKit Framework processes payment.
- Post the binary receipt data to our server, perform server-server validation.
- Update the user’s record of the parsed data.
- Return the latest expiration date to the app to store on the device for when to restrict access.
- If successful, finish this transaction.
- If error, leave this transaction in the transaction queue.
Persisting the auto-renewal:
- Find all users binary receipt data with subscriptions due to expire in the next n hours.
- Perform server-server validation for each user -> should get the new expiration date for those who have been renewed by Apple.
- Update the user’s database records according to the parsed receipt data returned.
I have server-server validation setup and working. The only problem is testing the recurring element. I understand 1 month = 5 minutes, and my theory is that I should be able to manually fire the would-be cron triggered script, to perform a server-server validation check for Apple to return the latest receipt data.
However, once 5 minutes has passed the account should have auto-renewed, but when we validate the receipt using the server script, it gives us back old information. We have to go into the app and the transaction observer receives the renewal call-back, with unsubscribed UI and having to wait for the request to process this renewal (as well as password input prompts).
Any help at all with this would be greatly appreciated.