We’ve implemented consumables as an add-on along side our subscription. The high-level flow is: user makes purchase in-app —> RC sends webhook —> we increment the user’s balance in our database.
How should a consumable purchase be validated locally.
After receiving the CustomerInfo
object in the purchase completion handler, what do I specifically look for? With subscriptions or non-consumables I just check to see if the entitlement is present. Consumables obviously don’t require permanent entitlements.
I can filter the object’s nonSubscriptions
array for the correct productIdentifier
, and then check if its purchaseDate
is less than 30 seconds old.
This feels brittle—for example, somebody could easily make a purchase of the consumable and then quickly attempt it again and the code above would consider them having purchased it twice.
Thoughts on this? Should I just show a loading animation and query my database here instead?
pedited to remove second question because I found the answer here]