stripe-firebase-extensions icon indicating copy to clipboard operation
stripe-firebase-extensions copied to clipboard

Subscription sub collection not created in Firestore Database under Customers collection

Open bcthakre opened this issue 2 years ago • 1 comments

Bug report

  • Extension name: firestore-stripe-payments

Describe the bug

FireStore collections as "subscriptions" is not being created.

To Reproduce

When you are in the Firebase Dev Console and click on Extensions > Stripe Extension Manage Button > Extension Configuration

Description: What is the path to the Cloud Firestore collection where the extension should store Stripe pricing plans?

products

Description: What is the path to the Cloud Firestore collection where the extension should store Stripe customer details? This can be the location of an existing user collection, the extension will not overwrite your existing data but rather merge the Stripe data into your existing uid docs.

Description: What is the path to the Cloud Firestore collection where the extension should store Stripe configuration?

configuration

Description : Do you want to automatically sync new users to customer objects in Stripe? If set to ‘Sync’, the extension will create a new customer object in Stripe and add a new doc to the customer collection in Firestore when a new user signs up via Firebase Authentication. If set to ‘Do not sync’ (default), the extension will create the customer object “on the fly” with the first checkout session creation.

Sync

Description : Do you want to automatically delete customer objects in Stripe? When a user is deleted in Firebase Authentication or in Cloud Firestore and set to ‘Auto delete’ the extension will delete their customer object in Stripe which will immediately cancel all subscriptions for the user.

Do not delete

Description: What is your Stripe API key? We recommend creating a new restricted key with write access only for the “Customers”, “Checkout Sessions” and “Customer portal” resources. And read-only access for the “Subscriptions” and “Plans” resources.

API_KEY

Description: This is your signing secret for a Stripe-registered webhook. This webhook can only be registered after installation. Leave this value untouched during installation, then follow the postinstall instructions for registering your webhook and configuring this value.

Signing Secret Key [While pasting this from Stripe, Firebase is also adding the "Configuration" string at the end]

Firebase Functions Logs Error:

[Error]: Webhook signature verification failed. Is your Stripe webhook secret parameter configured correctly? No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? https://github.com/stripe/stripe-node#webhook-signing

Expected behavior

Firestore Database should have a "subscriptions" sub-collection under the "customers" collection. Customers collection has been created and "checkout_sessions" as well but not "subscriptions".

System information

  • macOS
  • Chrome

Additional context

I believe this error is because Firebase is having issues connecting to Stripe since Stripe CLI command "Stripe Listen" is generating checkout.session.completed

bcthakre avatar May 01 '22 03:05 bcthakre

Hi @bcthakre

Thanks for the detailed update, I may be a little confused but to reproduce you have [Error]: Webhook signature verification failed..

Have you updated this in your project, or is this intentional configuration for reproducing the error?

dackers86 avatar Jun 18 '22 21:06 dackers86