Hey! I’m exploring a system in my app where users can either pay a one-time fee to unlock a single specific article in a news app, or subscribe (monthly) to unlock all articles in the app.
The subscription is easy. Product => Entitlement, check for the entitlement, badaboom, done.
I am however not 100% sure on the best way to “unlock a single article”.
I understand how to trigger the purchase, and I understand I need to implement a webhook against NON_RENEWING_PURCHASE to confirm receipt. What I’ve yet to nail down is the method in which my server knows which article to unlock.
- Is there a way to attach any form of metadata in the purchase? (`article: 123456`). I can’t seem to spot it.
- Alternatively, is the flow to have the app itself (after the purchase goes through) call an “unlock” API on my server with transactionId and article ID, which then looks for a corresponding webhook?
With this flow, how would folks recommend handling the race condition between the webhook (which per docs can take in excess of 60s, though often much quicker) vs the purchase confirmation (which is very quick).
- Is the third option to skip the webhook entirely and use the REST API? iOS SDK confirms purchase, calls my API with the transactionId and article ID, my API queries RevenueCat to confirm purchase, then unlocks the content? (Will RevenueCat always have the transaction before purchase callback is called?)
Any and all insights are very much appreciated! Thanks
(Note: I have for the purpose of discussion simplified the actual product, it’s not articles… but it’s easier to discuss when we all understand the proposition!)
