SuperAPI AI Directory

stripe-cli

Coding & development

View repository

Updated 10-15 21:55

About this skill

Stripe CLI

Official CLI for Stripe. Test webhooks locally, manage resources, and trigger events without the dashboard.

Authentication

stripe login                    # Opens browser for auth
stripe login --api-key sk_test_xxx  # Use API key directly

Common Commands

Webhook Testing

stripe listen                                    # Forward all events to default endpoint
stripe listen --forward-to localhost:3000/webhook # Forward to local server
stripe listen --events payment_intent.succeeded   # Filter specific events
stripe trigger payment_intent.succeeded           # Trigger a test event
stripe trigger customer.subscription.created      # Test subscription flow

Resources

stripe customers list --limit 5
stripe customers create --name "Test User" --email test@example.com
stripe payment_intents create --amount 2000 --currency usd
stripe products list
stripe prices list --product prod_xxx
stripe subscriptions list --customer cus_xxx

Logs and Events

stripe logs tail                # Stream API logs in real-time
stripe events list --limit 10
stripe events resend evt_xxx

Fixtures

stripe fixtures path/to/fixture.json   # Run a fixture file for test data

Agent Best Practices

  • Always use test mode keys (sk_test_*) for agent operations
  • Use --json or pipe output through jq for structured data
  • stripe listen runs as a long-lived process - run it in background
  • Use stripe trigger to test webhook handlers without real transactions
  • The stripe logs tail command is invaluable for debugging API issues
  • Use stripe resources to discover available resource types

Example Workflows

Set up local webhook testing

stripe listen --forward-to localhost:3000/api/webhooks \
  --events checkout.session.completed,payment_intent.succeeded

Create a test customer with subscription

CUSTOMER=$(stripe customers create --name "Test" -q --json | jq -r '.id')
stripe subscriptions create --customer "$CUSTOMER" --price price_xxx