stripe / stripe-cli

A command-line tool for Stripe
https://stripe.com/docs/stripe-cli
Apache License 2.0
1.57k stars 362 forks source link

Have the CLI Reuse and Cleanup the test data it creates (i.e. clean up your own mess) #1092

Open hades200082 opened 1 year ago

hades200082 commented 1 year ago

Problem

Use the Stripe CLI to build out integrations without interfering with other users creating test products that are effectively "drafts" waiting to move to production or getting in their way.

As it stands the Stripe CLI can create hundreds or thousands of products, customers, etc. in a single day of development and testing. It's unacceptable that this test data is left in my test account with no simple way to remove it without also removing the test data I created manually (i.e. the drafts of what will be my live plans/products eventually)

Feature

  1. Stripe CLI should re-use the products, customers, etc. that it creates rather than creating new ones on every trigger command.
  2. Stripe CLI should keep track of the things (maybe using metadata on the items or something, or storing it locally if required) it creates and provide a mechanism to delete all of the CLI-created test data at the end of a session or on-demand.

As I see it the stripe CLI is creating a mess in my test account. It's the CLIs responsibility to clean up after itself.

Also see:

jsteele-stripe commented 1 year ago

Thanks for the suggestion! In the meantime, you can delete all test data on the account with a single click via the Dashboard.

hades200082 commented 12 months ago

The problem I'm facing is that I have products in the test environment that I need to keep. Deleting the test data manually is at best tedious and at worst impossible.

chpmrc commented 12 months ago

Yeah this is quite the disappointment. Deleting all your test data also deletes all the products etc. that you carefully crafted, not just the mock products created by the CLI. Found out the hard way...

ginjo commented 11 months ago

Doing a google search for stripe test webhooks, I discovered the stripe-cli 'trigger' function and merrily went about developing and refining my webhook integration. I even created a handy wrapper script to display both sides of the operation in a split-pane screen session. Later, I went to my dashboard to change some settings and discovered the awful mess I'd made (Vat of Acid episode, Rick & Morty). Doing a full-wipe of my test-mode environment is not an option, as I have valuable prototype and longer-term test data that I need to keep.

If stripe-cli won't track and clean up the data it creates, we need some other options. Here are some suggestions.

hades200082 commented 11 months ago

I've stopped using trigger now.

Instead I create the event by using the checkout, then I replay the events that created as needed.

ginjo commented 11 months ago

@hades200082 Cool, are you using the CLI to replay, or is that a dashboard-only function?

hades200082 commented 11 months ago

I use the CLI to replay it.