I am attempting to keep my database up to date with my users’ subscription states via RevenueCat’s webhooks. When my server receives an event from RC, it extracts the `app_user_id` and immediately hits the /subscribers API endpoint to fetch the new subscription info for that user and save it to my database. This seems to be working for new subscriptions, renewals, and cancellations.
I am running into an issue with the `TRANSFER` event type, however. I can trigger this event by logging out one of my users, logging into a new account, and restoring purchases. The Apple ID remains the same throughout, and I correctly log in/out to the Purchases SDK at the correct times, so RC (correctly) transfers the entitlements over to the new user ID.
I receive the `TRANSFER` event via webhook, and handle it as a special case. Instead of simply extracting and refreshing the `app_user_id` (which isn’t present), I check the user IDs in `transferred_from` and `transferred_to`. The user IDs are then sent as usual to the `/subscriptions` endpoint for their current state.
At this point, though, I find that both users have no entitlements. The `subscriber.entitlements` property is empty. I would expect it to be empty for the user ID that was `transferred_from`, but I would expect it to be populated for the user that was `transferred_to`. In fact, if I wait a few moments and hit the `subscribers` endpoint again manually, I see the entitlements correctly included. But by this point it is too late - my server has already responded to the event by pulling the latest subscriber info and updating my user to have no entitlement.
Is this expected behavior? Shouldn’t the subscriber state provided by the API be up-to-date before the webhook fires? How should I be handling this? Perhaps some artificial delay before I fetch the user’s subscription info? If so, how long?