Coder Social home page Coder Social logo

stripe-test-data's Introduction

Generate test data with the Stripe CLI

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.

Available test fixtures

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

How to use

1. Clone the repository

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.

3. Run the fixture command with the test data you want to seed

The CLI will create all the Stripe objects defined in the fixture file in test mode.

stripe fixtures two-sku-store/create-fixtures.json

4. You should now see the test data in your Dashboard! ✨

An image of the newly create SKU in the Dashboard

5. [optional] Delete the test data

Each fixture has a delete-fixtures.json that cleans up the relevant test data.

Contribute

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:

  1. A new directory for your test fixtures (e.g. two-sku-store).
  2. A create-fixtures.json file that creates the test data.
  3. A delete-fixtures.json that tears down the test data.
  4. [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!)

Get support

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:

Sign up to stay updated with developer news.

stripe-test-data's People

Contributors

adreyfus-stripe avatar ch-stripe avatar dawn-stripe avatar mfix-stripe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.