My app backend needs to add balance to my user’s account for each new subscription purchase, what is the delay before a new subscription is sent to my configured webhook?
Hi
Most webhooks will be delivered in near real-time, but delays are possible. Most cases this is just a second or so, but could be minutes, or in rare cases hours. For INITIAL_PURCHASES
(the case you’re describing here), if the purchase was initiated in the app, the SDK would notify RevenueCat and webhook event will be dispatched. For any purchases made outside of the app (e.g: renewals, upgrades/downgrades, etc) this will be sent to RevenueCat via S2S notifications.
To help reduce any delays, we recommend setting up Platform Server (S2S) Notifications: https://docs.revenuecat.com/docs/server-notifications
If you’re just looking for the webhook to confirm purchase of a product, you can build redundancies in the app by pinging your servers in the purchase completion block and make a call server side to RevenueCat’s GET /subscribers endpoint to unlock any access or map the product to a specific balance to add to the account.
Hi
When I call GET subscriber there is no information about recent transactions, it only tells me the entitlements, this is not enough because I need to add balance to users for certain subscriptions.
Only knowing whether user has entitlement cannot prevent user from calling the backend API multiple times to add balances multiple times for a subscription initial purchase.
In the redundancy case you mentioned above, is there a way to translate the webhook transaction_id
field (described as “Transaction identifier from Apple/Google” in the webhook doc here) into the RevenueCat unique id that is retrieved from GET /subscribers or in the PurchaserInfo object? I don’t see the unique RevenueCat id in the webhook events.
Hey
There unfortunately isn’t a way to translate the Apple/Google transaction ID into the RevenueCat transaction ID - we’ll hopefully be cleaning this up in the next API and Webhooks versions, but those are on the mid to longer term roadmap.
As a workaround, you may need to have the webhook event trigger an API call to GET /subscribers to get the additional information you need. I know it’s not the cleanest but should work.
Thanks
Thank you
Thanks
Yes, it would get removed from the API response
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.