Stripe

From mvanhorn/printing-press-library · View interactive version

Stripe is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. Every Stripe feature, plus a local SQLite mirror with FTS, cross-entity SQL, and analytics no other Stripe tool ships. Trigger phrases: `stripe customer health`, `stripe dunning queue`, `stripe health`, `stripe payout reconcile`, `subs about to expire`, `use stripe-pp-cli`, `run stripe-pp-cli`.

How to use this skill

Skill file

Stripe — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the stripe-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:

  1. Install via the Printing Press installer. It defaults binaries to $HOME/.local/bin on macOS/Linux and %LOCALAPPDATA%\Programs\PrintingPress\bin on Windows:

```bash

npx -y @mvanhorn/printing-press-library install stripe --cli-only

```

  1. Verify: stripe-pp-cli --version
  2. Ensure the reported install directory is on $PATH for the agent/runtime that will invoke this skill.

If the npx install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.26.6 or newer):

go install github.com/mvanhorn/printing-press-library/library/payments/stripe/cmd/stripe-pp-cli@latest

If --version reports "command not found" after install, the runtime cannot see the binary directory on $PATH. Do not proceed with skill commands until verification succeeds.

When to Use This CLI

Reach for stripe-pp-cli when you need to (1) run analytics across customers/subs/invoices that Stripe's dashboard doesn't expose, (2) script payment ops in a CI/agent loop without daemon processes, (3) reconcile payouts and balance transactions, or (4) feed Stripe state into a non-Stripe system (CRM, accounting, outreach automation).

When NOT to Use This CLI (anti-triggers)

Do not use stripe-pp-cli for:

Not Yet Wired (deferred to v0.2)

| Area | Status | Workaround |

|------|--------|-----------|

| Stripe Issuing (full workflow) | endpoint passthrough only | Use Stripe Dashboard |

| Stripe Terminal (in-person SDK) | endpoint passthrough only | Use Terminal SDK |

| Stripe Tax registration | tax-rates CRUD only | Use Stripe Tax in Dashboard |

| localstripe mock server | out of scope | Use stripe-mock via STRIPE_BASE_URL |

| Connect account fan-out | single-account at a time | External script loops |

Unique Capabilities

These capabilities aren't available in any other tool for this API.

Local state that compounds

_Use this to feed customer-health signals into outreach, dunning, and renewal automation without burning hundreds of API calls per customer._

```bash

stripe-pp-cli health cus_xyz --json --select score,failed_payments,mrr_contribution

```

_When deciding which customers to follow up with about failed payments, this beats walking the Stripe dashboard or chaining 4+ API calls per row._

```bash

stripe-pp-cli dunning-queue --json --select invoice,customer_email,days_overdue,last_failure_reason

```

_When a one-off question doesn't fit the canned commands, drop into SQL instead of writing a script that hits the API a thousand times._

```bash

stripe-pp-cli sql "SELECT json_extract(data,'$.email') AS email, COUNT(*) AS active_subs FROM resources WHERE resource_type='subscriptions' AND json_extract(data,'$.status')='active' GROUP BY json_extract(data,'$.customer') HAVING active_subs > 1" --json

```

_Use this for end-of-period payout reconciliation against bank statements or accounting systems — replaces the manual CSV-pivot ritual._

```bash

stripe-pp-cli payout-reconcile --since 7d --csv

```

_Use this monthly to proactively email customers whose card is about to expire — prevents involuntary churn._

```bash

stripe-pp-cli subs-at-risk --within 30d --json --select customer_email,mrr,card_exp

```

_When integrating Stripe with a CRM via metadata tags, this finds every related resource in one query._

```bash

stripe-pp-cli metadata-grep 'crm_id=acme-001' --json

```

Agent-native plumbing

_Use this as the first command when investigating a customer ticket, support escalation, or churn risk — full context in one call._

```bash

stripe-pp-cli customer-360 alice@example.com --json --compact

```

_Use this in cron-driven agent loops to replay only new events since the last run — no daemon to babysit, no missed events._

```bash

stripe-pp-cli events-since --type 'invoice.*' --json --select id,type,created,data.object.id

```

Command Reference

account — Manage account

account-links — Manage account links

account-sessions — Manage account sessions

accounts — Manage accounts

apple-pay — Manage apple pay

application-fees — Manage application fees

apps — Manage apps

balance — Manage balance

balance-settings — Manage balance settings

balance-transactions — Manage balance transactions

billing — Manage billing

billing-portal — Manage billing portal

charges — Manage charges

checkout — Manage checkout

climate — Manage climate

confirmation-tokens — Manage confirmation tokens

country-specs — Manage country specs

coupons — Manage coupons

credit-notes — Manage credit notes

customer-sessions — Manage customer sessions

customers — Manage customers

disputes — Manage disputes

entitlements — Manage entitlements

ephemeral-keys — Manage ephemeral keys

events — Manage events

exchange-rates — Manage exchange rates

file-links — Manage file links

files — Manage files

financial-connections — Manage financial connections

forwarding — Manage forwarding

identity — Manage identity

invoice-payments — Manage invoice payments

invoice-rendering-templates — Manage invoice rendering templates

invoiceitems — Manage invoiceitems

invoices — Manage invoices

issuing — Manage issuing

mandates — Manage mandates

payment-attempt-records — Manage payment attempt records

payment-intents — Manage payment intents

payment-links — Manage payment links

payment-method-configurations — Manage payment method configurations

payment-method-domains — Manage payment method domains

payment-methods — Manage payment methods

payment-records — Manage payment records

payouts — Manage payouts

plans — Manage plans

prices — Manage prices

products — Manage products

promotion-codes — Manage promotion codes

quotes — Manage quotes

radar — Manage radar

refunds — Manage refunds

reporting — Manage reporting

reviews — Manage reviews

setup-attempts — Manage setup attempts

setup-intents — Manage setup intents

shipping-rates — Manage shipping rates

sigma — Manage sigma

sources — Manage sources

subscription-items — Manage subscription items

subscription-schedules — Manage subscription schedules

subscriptions — Manage subscriptions

tax — Manage tax

tax-codes — Manage tax codes

tax-ids — Manage tax ids

tax-rates — Manage tax rates

terminal — Manage terminal

test-helpers — Manage test helpers

tokens — Manage tokens

topups — Manage topups

transfers — Manage transfers

treasury — Manage treasury

webhook-endpoints — Manage webhook endpoints

Finding the right command

When you know what you want to do but not which command does it, ask the CLI directly:

stripe-pp-cli which "<capability in your own words>"

which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.

Recipes

Find double-subscribed customers

stripe-pp-cli sql 'SELECT json_extract(s.data,"$.customer") AS cid, COUNT(*) AS subs FROM resources s WHERE s.resource_type="subscriptions" AND json_extract(s.data,"$.status")="active" GROUP BY cid HAVING subs > 1' --json

All Stripe data lives in the generic resources table; query JSON fields with json_extract.

Top 10 customers with at-risk PM

stripe-pp-cli subs-at-risk --within 30d --limit 10 --json --select customer_email,mrr,card_exp

Email these customers proactively before involuntary churn hits.

Replay missed events since last cron tick

stripe-pp-cli events-since --type 'invoice' --json --select id,type,created,data.object.id

Cursor-driven event tail — one-shot, agent-friendly, persists cursor between runs.

Reconcile this week's payouts

stripe-pp-cli payout-reconcile --since 7d --csv

Joins payout → balance_transactions → charges → customers; flags missing rows.

Compact customer dossier for agent context

stripe-pp-cli customer-360 alice@example.com --json --select customer.email,active_subscriptions,open_disputes,lifetime_spend

Use --select to project deeply-nested fields; saves tokens vs full dossier.

Auth Setup

Authenticate by exporting STRIPE_SECRET_KEY=sk_test_... (recommended) or running stripe-pp-cli auth set-token <key> to persist it. CLI endpoint writes with a live secret or restricted key require --confirm-live or STRIPE_CONFIRM_LIVE=1. CLI --dry-run previews make no request. MCP stripe_execute requires top-level confirm_live: true or STRIPE_CONFIRM_LIVE=1 for live writes; confirmation inside params does not count. Reads and test-key requests do not need confirmation.

Run stripe-pp-cli doctor to verify setup.

Agent Mode

Add --agent to any command. Expands to: --json --compact --no-input --no-color --yes.

```bash

stripe-pp-cli account --agent --select id,name,status

```

Response envelope

Commands that read from the local store or the API wrap output in a provenance envelope:

{
  "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
  "results": <data>
}

Parse .results for data and .meta.source to know whether it's live or local. A human-readable N results (live) summary is printed to stderr only when stdout is a terminal — piped/agent consumers get pure JSON on stdout.

Agent Feedback

When you (or the agent) notice something off about this CLI, record it:

stripe-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
stripe-pp-cli feedback --stdin < notes.txt
stripe-pp-cli feedback list --json --limit 10

Entries are stored locally at ~/.stripe-pp-cli/feedback.jsonl. They are never POSTed unless STRIPE_FEEDBACK_ENDPOINT is set AND either --send is passed or STRIPE_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.

Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.

Output Delivery

Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:

| Sink | Effect |

|------|--------|

| stdout | Default; write to stdout only |

| file:<path> | Atomically write output to <path> (tmp + rename) |

| webhook:<url> | POST the output body to the URL (application/json or application/x-ndjson when --compact) |

Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.

Named Profiles

A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.

stripe-pp-cli profile save briefing --json
stripe-pp-cli --profile briefing account
stripe-pp-cli profile list --json
stripe-pp-cli profile show briefing
stripe-pp-cli profile delete briefing --yes

Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.

Exit Codes

| Code | Meaning |

|------|---------|

| 0 | Success |

| 2 | Usage error (wrong arguments) |

| 3 | Resource not found |

| 4 | Authentication required |

| 5 | API error (upstream issue) |

| 7 | Rate limited (wait and retry) |

| 10 | Config error |

Argument Parsing

Parse $ARGUMENTS:

  1. Empty, help, or --help → show stripe-pp-cli --help output
  2. Starts with install → ends with mcp → MCP installation; otherwise → see Prerequisites above
  3. Anything else → Direct Use (execute as CLI command with --agent)

MCP Server Installation

  1. Install the MCP server:

```bash

go install github.com/mvanhorn/printing-press-library/library/payments/stripe/cmd/stripe-pp-mcp@latest

```

  1. Register with Claude Code:

```bash

claude mcp add stripe-pp-mcp -- stripe-pp-mcp

```

  1. Verify: claude mcp list

Direct Use

  1. Check if installed: which stripe-pp-cli

If not found, offer to install (see Prerequisites at the top of this skill).

  1. Match the user query to the best command from the Unique Capabilities and Command Reference above.
  2. Execute with the --agent flag:

```bash

stripe-pp-cli <command> [subcommand] [args] --agent

```

  1. If ambiguous, drill into subcommand help: stripe-pp-cli <command> --help.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.