invertase / stripe-firebase-extensions

Repository of Firebase Extensions built by Stripe.
https://firebase.google.com/products/extensions
Apache License 2.0
438 stars 173 forks source link

CustomClaims "stripeRole" is removed on overdue subscriptions. #588

Open ClassyD opened 11 months ago

ClassyD commented 11 months ago

Bug report

Describe the bug

I'm not sure if this a bug or a feature 😄 So when a user's subscription payment is 'overdue' i.e (payment failed, card declined on subscription update) it seems that the stripeRole claims is removed.

I think its because of this line https://github.com/invertase/stripe-firebase-extensions/blob/107031923116d776ace0d33011a28d29e48fe827/firestore-stripe-payments/functions/src/index.ts#L562 it should probably also include 'overdue' 🤔 or something along that line

To Reproduce

  1. Subscribe to a product
  2. update the payment method so that the payment fails due to insufficient funds
  3. the subscription status is then set to 'Overdue' by stripe
  4. Then the stripeRole is removed

Expected behavior

I expect that that the stripeRole is only removed once the subscription status is 'Canceled ' Which means during the 'overdue' period the user has a grace period until the issue is resolved with the payments or the subscription is cancelled

kynesisDev commented 3 weeks ago

Is the stripeRole restored when the user makes the payment?