I work on an e-reader app that sells books as IAPs. We have a lot - about 20,000 or so. This is over Apple's limit of 10,000 IAPs, so we've had to ask them to raise the limit for us more than once. Recently, at Apple's suggestion, we finally switched to a mechanism called Price Tiers, where instead of having one IAP item in App Store Connect for each of our products, we have one item per price level, so if the user buys product ID (in our system) 12345 for $5, instead of buying non-consumable IAP ID com.mycompany.myapp.12345
, they buy consumable IAP ID com.mycompany.myapp.price_tier.5
. In our system, we link the purchase to product 12345 at the time of receipt verification and everything works great.
But I have an issue that manifests when the user is using Ask to Buy or when receipt validation fails in our back-end, I don't call finishTransaction
, and the transaction is retried later. The sequence is this:
- User buys product 12345, which is
com.mycompany.myapp.price_tier.5
- The user has Ask to Buy enabled, so the transaction ends in the
deferred
state, and the IAP flow on the device is done for now - At some point later, the user gets permission for the purchase, and my
SKPaymentQueue
delegate gets notified of the transaction again in the background
But at the point of step 3, I have no way of knowing what product in our system the transaction is for. The same issue occurs if receipt verification fails on our end - I don't call finishTransaction
, so StoreKit retries it later, but again at that point I don't know which one of our products to register to the user's account.
How do I make Ask to Buy (or any situation where I get notified of a transaction outside of a user-driven purchase) work with Price Tiers?