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

Ability to trigger webhooks to repopulate Firestore after restarting Emulator

Open b0ot opened this issue 3 years ago • 2 comments

Feature request

  • Extension name: [e.g. firestore-stripe-payments, or leave empty if suggesting a new extension] -Run Payments with Stripe

Is your feature request related to a problem? Please describe.

I develop and test everything via the Firestore Emulators before pushing live. Currently when you close the emulator and restart it, by default it wipes everything including the Firestore. Currently Stripe webhooks only are triggered when things are initially setup or changed. This means when you restart the emulator all of a sudden all product information, pricing information, customer information, etc is lost. I would like an easy way to load this information into the database for testing.

Describe the solution you'd like

It would be extremely helpful to be able to trigger an httpsCallable function that would provide a complete dump of all the information that needs to get reloaded into the Firestore.

Describe alternatives you've considered

Option 1: Export Firestore & Import it You could export the Firestore database and then import it again, however this requires you to always remember to export it. If you ever forget, things will not be synced. In addition there are often times where you want to test different aspects of your site and want different configs. This becomes near impossible to manage with this strategy.

Option 2: Delete all products on Stripe Dashboard and reload them. Would work but is extremely tedious.

Option 3: Try to modify each product, price, etc to retrigger the webhook. However this becomes a pain after a transaction as things scuh as pricing get locked.

Additional context

Add any other context or screenshots about the feature request here.

b0ot avatar Aug 26 '22 18:08 b0ot

Option 2 - Upon further testing Option 2 is not viable as you can't actually delete products once they are used in a transaction.

b0ot avatar Aug 26 '22 18:08 b0ot

Ok, this is old but you can dofirebase emulators:start --import=exported-dev-data --export-on-exit=exported-dev-data which saves your data on exit and imports it on start. The exit needs a clean CTRL+C.

MikeMichel avatar Sep 05 '23 18:09 MikeMichel