invertase / stripe-firebase-extensions

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

Dashboard customer delete causes checkout session to timeout #385

Open mikkoh opened 2 years ago

mikkoh commented 2 years ago

Bug report

Describe the bug

A user signs up + pays for a subscription. Then if the customer is deleted in the Stripe Dashboard the customer information continues to exist Firestore. Once the user tries to signup for the subscription again, using the firestore-stripe-web-sdk, the web sdk will simply timeout.

If you manually delete the customer documents in Firestore after deleting in the Stripe Dashboard everything works as expected.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. In browser customer pays + signs up for subscription using firestore-stripe-web-sdk
  2. Firestore Documents are created for customer. Everything works as expected
  3. Go into the Stripe Dashboard and delete the customer
  4. Customer tries to re-subscribe using firestore-stripe-web-sdk
  5. firestore-stripe-web-sdk timesout

Expected behavior

Customer data in Firestore is automatically deleted when the stripe customer data is deleted.

System information

Additional context

Manually deleting the customer documents fixes the issue.

Onyoursix commented 2 years ago

I'm also dealing with this same issue. From what I can gather the customer id in stripe is tied to firebase auth. So when you delete a customer in stripe and then they try to pay again, it uses the same customer id which is now a deleted customer. In firebase there is an error stored in the doc "No such customer: 'cus_XXXXXXXXXXXXXX'" would be nice if that's the case, a new customer_id could be generated.

I tried to see if Stripe customer service could restore the deleted customer but they can't. They referred me here.