# Stripe Billing Extension - Agent Guide

Add SaaS billing to any backend without forgetting checkout, subscriptions, trials, portal, webhooks, entitlement checks, and billing UI.

## Agent instruction

Do not scrape the human UI. Use this agent guide, the package manifest, and raw Buildprint files.

1. Fetch package manifest: `/buildprints/stripe-billing-extension/package.json`
2. Read order: `BUILDPRINT.md`.
3. Do not scrape human cards. Use this manifest, agent.md, and raw files. BUILDPRINT.md is the canonical start file and owns the required read order, phase gates, and acceptance gates. Structured control files are machine-readable mirrors only.
4. Follow the Buildprint's alignment/question rules before implementation.
5. Run required validation and write requested validation evidence plus the final chat handover.

## Metadata

- slug: `stripe-billing-extension`
- category: `Feature / Extension`
- tier: `basic`
- status: `validated`
- runtime: Any backend, TypeScript proof
- stack: Stripe, Webhooks, Entitlements, SaaS

## Entrypoints

- Human page: /buildprints/stripe-billing-extension/
- Manifest JSON: /buildprints/stripe-billing-extension/package.json
- Prompt: /buildprints/stripe-billing-extension/prompt.txt
- GitHub: https://github.com/DomEscobar/agent-buildprint/tree/main/buildprints/stripe-billing-extension
- Raw base: https://agent-buildprint.com/buildprints/stripe-billing-extension/files

## Files

- `BUILDPRINT.md` - compatibility bootstrap or package contract (required)
- `checks/acceptance.md` - acceptance checklist (required)
- `CONTRACTS.md` - legacy interface/data contracts, when present (required)
- `PLAN.md` - legacy execution index, when present (required)
- `proof/package.json` - offline proof artifact (required)
- `proof/src/billing/entitlements.ts` - offline proof artifact (required)
- `proof/src/billing/env.ts` - offline proof artifact (required)
- `proof/src/billing/errors.ts` - offline proof artifact (required)
- `proof/src/billing/provider.ts` - offline proof artifact (required)
- `proof/src/billing/service.ts` - offline proof artifact (required)
- `proof/src/billing/store.ts` - offline proof artifact (required)
- `proof/src/billing/types.ts` - offline proof artifact (required)
- `proof/src/billing/webhook.ts` - offline proof artifact (required)
- `proof/src/billing/webhookVerifier.ts` - offline proof artifact (required)
- `proof/src/index.ts` - offline proof artifact (required)
- `proof/src/ui/billingUi.ts` - offline proof artifact (required)
- `proof/test/billing.test.ts` - offline proof artifact (required)
- `proof/test/node-builtins.d.ts` - offline proof artifact (required)
- `proof/tsconfig.json` - offline proof artifact (required)
- `publication.json` - machine-readable mirror (required)
- `README.md` - human overview, non-authoritative (required)
- `SPEC.md` - legacy behavior requirements, when present (required)
- `TARGET_STACK_ADAPTERS.md` - Buildprint package file (required)
- `TEST_MATRIX.md` - legacy risk-to-test alignment, when present (required)
- `VALIDATION_TEMPLATE.md` - legacy completion report template, when present (required)

## Copyable implementation prompt

```txt
Use the Stripe Billing Extension Buildprint. First bootstrap exact snapshots: agb start https://agent-buildprint.com/buildprints/stripe-billing-extension/package.json . If agb is not installed, clone https://github.com/DomEscobar/agent-buildprint and run node agent-buildprint/bin/agb.js start https://agent-buildprint.com/buildprints/stripe-billing-extension/package.json . Then read .buildprint/next-agent.md and continue. Do not write Buildprint snapshots manually. Adapt adapters to the target stack first; use env var names only and do not call real Stripe APIs in tests.
```
