Skip to main content

Hello, I think I’ve integrated RevenueCat successfully, but I'm encountering an issue with downgrades I use Firebase to store user credits, and Cloud Functions trigger updates based on events.

The problem is that RevenueCat sends an "Initial Purchase" event when a user downgrades their subscription. This event doesn't differentiate between a new purchase and a downgrade. As a result, my Cloud Function awards credits to users even when they downgrade, which isn't the desired behavior.

I think it would a good idea to indicate in the event what type it is.

Or am i missing something ?

Thanks

Hey @max anders,

You should be getting two events, a product change event (that’s the downgrade you’re looking for) and an initial purchase or renewal event when the downgraded subscription actually begins. The product change event shouldn’t be used to award credits, but I imagine when the downgraded subscription begins, you do want to award credits?

Either way, you can find the type of event by checking the `name` property of the event. Take a look at our sample events: https://www.revenuecat.com/docs/integrations/third-party-integrations/firebase-integration#sample-events