Hi,
Im trying to keep my database in sync with each users current state.
Webhooks
First I tried to use web hooks data but I ran into multiple issues:
- The basic event from the documentation (above all other examples like initial purchase) has way more fields like a real promo code event.
- Im not sure what user ids to compare. original_app_user_id, app_user_id especially with use cases like “restore subscription”. The documentation calls for comparing original_app_user_id but isn't it wrong in cases of restore and to prevent to be both users entitled here?
- “expiration_at_ms” is not under entitlement_ids like in the REST API, is this not the entitlement expiration date? Thats because another event for the same app_user_id returns a not migrated state but just for example for the new purchase and I have to store all events right?
I think there should be a way simpler web hook.
- RevenueCat detect a new event but instead of sending it, it checks the user state, do all the work and send the current state of the user back.
- In case of transfers or anything similar RevenueCat sends multiple events for the users to bring them all on the current state.
- The documentation needs some work for using web hooks, what Ids to compare in order to update the current state for each user (probably the most used case).
REST API
I could call the REST API on each web hook event to get the latest subscription status. This one expects the app_user_id what is provided by almost all events except “Transfer”.
“Transfer” is providing multiple “from” and “to” ids and again and this point I don't know what to do to sync both users.
- Should I call the REST API for all ids except the anonymous?
- What about delays on the web hook delivery? Does platform channel fix this or do I have to call from my frontend at least for purchase events to ensure the user can access the premium features instantly?
I really like the frontend integration but its quite a challenge to implement this in both of the available ways to work in call cases and Im blocked at this point.