Testing Stripe integrations can be tricky, especially for complex flows like subscriptions or Connect platforms.
We wrote some test fixtures to help you quickly generate test data with the Stripe CLI. Use these or write your own test fixtures following the same spec.
Learn more about the CLI's fixture command in the CLI documentation.
Fixture | Description | Relevant samples & products |
---|---|---|
two-plan-subscription | Sets up two different subscription plans, a "Basic" and a "Pro" plan | ⚬ Prebuilt subscription signup page (Checkout) ⚬ Custom subscription signup page (Elements) |
two-sku-store | Sets up a simple e-commerce inventory with a T-shirt product that has two "Basic" and "Fancy" SKUs that represent different shirt types | ⚬ Pre-built payment form (Checkout) |
customers-with-saved-cards | Creates two Customers that have test cards saved to them that can be used to charge later | ⚬ Charging a saved card |
customer-with-subscription | Creates a Plan that charges $10 once a day and subscribes a Customer to it | ⚬ Billing |
git clone https://github.com/stripe-samples/test-data
Be sure to log in with your Stripe credentials so the CLI can use your test mode API keys.
The CLI will create all the Stripe objects defined in the fixture file in test mode.
stripe fixtures two-sku-store/create-fixtures.json
Each fixture has a delete-fixtures.json
that cleans up the relevant test data.
We'd love contributions! Feel free to share a test fixture you found useful when building your Stripe integration.
Open a PR against this repo and add:
- A new directory for your test fixtures (e.g.
two-sku-store
). - A
create-fixtures.json
file that creates the test data. - A
delete-fixtures.json
that tears down the test data. - [optional] A little about the business you're building and why this test fixture helped you model it 😊 (only if you want some free advertising!)
If you found a bug or want to suggest a new [feature/use case/sample], please file an issue.
If you have questions, comments, or need help with code, we're here to help:
- on IRC via freenode
- on Twitter at @StripeDev
- on Stack Overflow at the stripe-payments tag
- by email
Sign up to stay updated with developer news.