Hi folks,
I'm experiencing some issues with handling pending purchases in our app. Let me first outline the scenario:
We have a consumable product that users can purchase repeatedly. Each time a user makes a purchase, we store tokens in Firestore collection associated with their Firebase Auth userId
. We've also integrated RevenueCat with Firestore to log purchase events and we are using the same AppUserID
in revenue cat as the Firebase Auth userId
to keep data in sync.
The issue arises when I test purchases using the “Slow test card (approved after a few minutes)” option. With this, the purchase initially goes into a "pending" state. I know that reopening the app later will register the purchase under the correct AppUserID
in both the RevenueCat dashboard and our Firestore collection tracking RevenueCat events.
I've read articles suggesting solutions, such as setting up a listener or periodically calling getCustomerInfo()
to monitor for updates. The goal would be to automate this so that if a purchase enters the pending state, our backend listens for purchase events tied to that specific AppUserID
and can update the user’s tokens accordingly. Does this seem like a viable solution, or are there any improvements I should consider?
The main issue occurs when a user initiates a purchase with the “Slow test card” and then logs out or uninstalls the app. If they later sign back in after the purchase completes, or even if they sign back in before the purchase completes, the RevenueCat dashboard registers the purchase, but it’s associated with an anonymous AppUserID
. The event collection on firestore also shows AppUserID = anonymous
in Firestore collection, meaning we lose track of the user-specific data.
I've searched for solutions to this, but haven't found anything that directly addresses this scenario. Any advice on how to handle this would be greatly appreciated!
Thank you in advance!
SDK Version: 8.9.0