In-App Purchases
Goals
- To allow users to purchase extra workout definitions in 7MW.
- To make Afterburner available to users with an active subscription only.
Requirements
The IAP system we implement must be flexible enough to allow the following:
- Allow the addition of other apps in the future that can use the same server-side data store.
- Allow the easy addition of an Android client at a later date.
- Allow us to sell workout definitions in 7MW as non-consumable IAPs.
- Allow us to sell and manage auto-renewable subscriptions for Afterburner.
- Allow users to restore previous purchases.
- Ensure that a subscription cannot be used to unlock content for multiple users.
Implementation
All IAP receipts are validated on the server, using Apple's server-to-server validation API.
- The IAP is purchased on the user's device as usual.
- The client posts the purchase receipt to /receipts/user_id/new_auto_id/receipt.
- The server will then pick this up and process it.
- The client listens at /receipts/user_id/same_auto_id/validation. The sever will add this ref after processing.
- If the receipt is valid, the server will make the necessary changes to other parts of the FRD and the client receives new/unlocked content etc through existing listeners.
- The client tells StoreKit the transaction has finished.
This is simply the overview of the process. The complexities are detailed in jira: