# stripe-ez

[![Socket Security](https://github.com/garrettsiegel/stripe-ez/actions/workflows/socket.yml/badge.svg)](https://github.com/garrettsiegel/stripe-ez/actions/workflows/socket.yml)
[![GitHub Sponsors](https://img.shields.io/badge/Sponsor-GitHub%20Sponsors-ea4aaa?logo=githubsponsors&logoColor=white)](https://github.com/sponsors/garrettsiegel)
[![Ko-fi](https://img.shields.io/badge/Sponsor-Ko--fi-ff5f5f?logo=kofi&logoColor=white)](https://ko-fi.com/garrettsiegel)

Zero-friction Stripe setup CLI.

`stripe-ez` walks you through Stripe setup and generates the files you need to start taking payments quickly.

## Links

- Website: [stripe-ez.com](https://stripe-ez.com)
- Repository: [github.com/garrettsiegel/stripe-ez](https://github.com/garrettsiegel/stripe-ez)
- Sponsor: [github.com/sponsors/garrettsiegel](https://github.com/sponsors/garrettsiegel)
- Ko-fi: [ko-fi.com/garrettsiegel](https://ko-fi.com/garrettsiegel)
- Contributing: [CONTRIBUTING.md](./CONTRIBUTING.md)
- Changelog: [CHANGELOG.md](./CHANGELOG.md)

## What It Does

- Guides Stripe authentication (Stripe CLI login or manual API key)
- Creates products and prices for one-time payments, subscriptions, or donations
- Supports checkout modes: hosted checkout, payment links, or embedded flows
- Optionally configures webhooks, customer portal, and tax behavior
- Generates local config, public config, `.env`, and framework-specific starter snippets

## Prerequisites

- Node.js 18+
- A Stripe account

Stripe CLI is optional, but recommended for easiest auth and local webhook testing.

## Quick Start

Run the CLI directly with `npx`:

```bash
npx stripe-ez
```

That command launches the guided setup.

## Easiest First Run

1. Run `npx stripe-ez`.
2. Choose `test` mode.
3. Pick Stripe CLI login when prompted (recommended).
4. Select your product type and checkout type.
5. Let stripe-ez generate your config and snippet output.

## Common Commands

Use `npx stripe-ez` for everything:

```bash
npx stripe-ez
npx stripe-ez init
npx stripe-ez add-product
npx stripe-ez status
npx stripe-ez reset
```

You can also hide the startup banner:

```bash
npx stripe-ez --no-banner
```

## What You Get

After setup, stripe-ez can generate:

1. `.stripe-ez.json` (private local state)
2. `stripe-config.json` (safe public app config)
3. `.env` (private secrets and IDs)
4. Framework starter snippets (Next.js, Express, React, Vanilla, Raw)
5. Payment link URLs (when payment links are enabled)

## Add Products Later

If you already have a setup and want to add more products:

```bash
export STRIPE_SECRET_KEY=YOUR_STRIPE_SECRET_KEY
npx stripe-ez add-product
```

## Check Your Setup

Show local config summary:

```bash
npx stripe-ez status
```

Check Stripe connectivity too:

```bash
STRIPE_SECRET_KEY=YOUR_STRIPE_SECRET_KEY npx stripe-ez status
```

## Local Webhook Testing

If your webhook endpoint is local, forward Stripe events with Stripe CLI:

```bash
stripe listen --forward-to http://localhost:3000/api/webhooks/stripe
```

Then set `STRIPE_WEBHOOK_SECRET` in your `.env`.

## Safety Tips

Before sharing your repo, remove local secrets:

```bash
rm -f .env .stripe-ez.json
```

## Need More Details?

For contributor and release workflow documentation, see `CONTRIBUTING.md` and `CHANGELOG.md`.
