Info: Whole Backend = Firebase.
That includes, Auth system, DB, Functions, Extensions etc.
In the app, I have let's say an account with User 'X' with userId 'xid'. X makes a purchase through the RevenueCat SDK and it sends out webhooks that writes database entries in Firebase with the necessary User details, purchases and entitlements.
I read these entitlements entries in the DB and unlock features within the App. Here in lies the dilemma.
Let's say User 'X' has purchased a monthly subscription. Webhooks and Firebase Integration will give me the DB entries I need to do my unlocking features.
All good so far. Now user 'X' has decided to delete their account having the userId 'xid' from the App. All good so far. Bear in mind that subscription is still active in Playstore/Appstore.
Now user 'X' decides to create a new account again in the App. User 'X' now ends up with a new UserId of 'yid'. User 'X' now presses the 'Restore Purchases' button which calls "Purchases.restorePurchases()" function from the RevenueCat SDK. It works as intended. Subscription has been transffered to the New userId of 'yid'. So far so good!.
Here begins my troubles.
When user 'X' normally made a purchase, a webhook was sent out with all the details which was then processed by RevenueCat's Firebase Extension which added to the Customers Collection with all of User 'X' purchase history. Which I read the entitlements from and unlock features. At this point on the first purchase, the document Id was 'xid'.
But when user 'X' runs the restore functionality, I expected a webhook which would create an entry in Customers Collection with the document Id 'yid'. But no webhook is made on restore. Hence I've no Customer Collection entry with details of the user's purchases and entitlements.
How can I get RevenueCat to hook me up with a webhook with the details so that it processes it normally like it was a fresh purchase? So that I can read the entitlements from the Customers Collection and unlock features after pressing the restore button.
Thank you for your time.