0

I've a web app (React) which uses Firebase as the backend. I'm integrating Stripe for subscriptions to my app. To sync a user's subscription details to Firestore, I installed this Run Payments with Stripe extension on Firebase. The extension says the following on how to create a subscription.

To subscribe the user to a specific pricing plan, create a new doc in the checkout_sessions collection for the user.

However, I'm trying to use Payment Links in my web app (which gives me greater flexibility and lesser maintainence going forward). I created a Payment Link and completed a purchase in Test Mode. But the user's subscription related data is not synced in Firestore.

I looked into the logs of the ext-firestore-stripe-payments-handleWebhookEvents function and found the following error.

❗️[Error]: Webhook handler for Stripe event [evt_xxxxxxxxxxxxxxxxxx] of type [customer.subscription.created] failed: User not found!

Now, I would like to know if it is possible to use Payment Links with this firebase extension? If yes, how can I sync the user id between Firebase and Payment Link, so that the user details are updated in Firestore and auth claims are set as described.

PS: The failed event doesn't show up in Stripe dashboard. Only successful webhook events are list item even though there is a separate tab for failed events.

imthath
  • 1,353
  • 1
  • 13
  • 35
  • I don't know much about firebase, but Payment Links can't be associated with a specific Customer object in Stripe. Each purchase with a Payment Link creates a new Customer. This might be the reason. Instead, you can look at using Stripe Checkout, which is also a hosted checkout experience, but offers a greater flexibility, incl. being able to attach an existing Customer: https://stripe.com/docs/payments/checkout. – vanya Jun 01 '23 at 10:26
  • Thanks for the insight. That could be a reason. – imthath Jun 01 '23 at 17:46
  • @vanya Not seeing where we're able to attach an existing customer using Stripe Checkout. Can you help with finding that specific information? – tazboy Aug 19 '23 at 14:43
  • @tazboy https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-customer – vanya Aug 21 '23 at 10:28

0 Answers0