Free sample · no email · 2,213 of 15,511 words
The Stripe & Payments Playbook
The opening of the playbook as your AI agent reads it. The full volume adds the step-by-step playbook, the prompts, the checklist and the sources.
1. The problem
A payment button is a small part of a payment system.
The system must agree on what the customer bought, what they owe, whether payment succeeded, what access they get, and what happens when things change. It must also explain those decisions to the customer and to the people running the business.
A sound design keeps four records apart:
| Record | Question it answers |
|---|---|
| Commercial agreement | What did the customer agree to buy? |
| Payment record | What happened to the attempt to collect? |
| Entitlement record | What can the customer use right now? |
| Accounting record | How is the transaction recorded and reconciled? |
A single is_paid field can’t represent all four.
What usually goes wrong
Take Lantern Ledger, a fictional software business used throughout this book. It sells monthly workspace access. A customer starts checkout, completes authentication, and closes the browser before returning to the app. If the app grants access only from its success page, the customer has paid and received nothing. Stripe warns explicitly against fulfillment that depends only on the landing page [8].
The opposite failure is just as serious. The app receives a checkout completion event, assumes every payment method has settled, and releases an expensive service while payment is still pending.
| Failure | Why it happens |
|---|---|
| Customer pays but never gets access | Fulfillment runs only on the success page [8] |
| Double fulfillment or double charges | No idempotency on writes; events processed twice after retries or duplicates [9][10] |
| Two subscriptions from one purchase | Each retry gets a new business identifier |
| Access continues after non-payment | Code handles invoice.paid but never past_due, unpaid or canceled [13] |
| Renewals stall for days | A webhook endpoint fails invoice.created, delaying invoice finalization by up to 72 hours [13] |
| Premium access without payment | An upgrade grants access before the extra payment succeeds |
| Customer loses time already paid for | Cancellation is applied immediately instead of at period end |
| Tax collected as zero | Stripe Tax is on, but no registration exists for that location [36] |
| Refund “lost” | Card refund pending on low balance, then fails with insufficient_funds [43] |
| Records disagree after a refund | Money returned, but invoice, tax records and subscription left inconsistent |
| Payout treated as revenue | Payouts net together payments, fees, refunds and other balance movements |
| Integration breaks on SDK bump | Unpinned version crosses a breaking release [1][2] |
| Dispute spike | Unclear statement descriptor, no renewal reminders, hidden cancellation [47] |
These are design failures, not just API mistakes.
Why old tutorials are risky in 2026
| Change | Practical consequence |
|---|---|
| Stripe ships named major releases with breaking changes, followed by backward-compatible monthly versions [1][2] | An unpinned SDK upgrade can silently move you across a breaking line |
| Basil (2025-03-31) moved billing periods to subscription items and removed legacy usage records [16][24] | Read item-level periods; don’t build on legacy usage records |
Endive (2026-09-30) removed the writable payment_method_types parameter on Checkout Sessions, PaymentIntents and SetupIntents, and retired the Payment Request Button in favor of the Express Checkout Element [3][4] |
Requests that still pass it fail; use dynamic payment methods |
| Flexible billing mode is Stripe’s recommended subscription mode, and subscriptions can’t migrate back to classic [15] | Test billing behavior before migrating |
| Stripe recommends Checkout Sessions for most payment integrations [28][29] | A custom UI doesn’t automatically mean building directly on PaymentIntents |
| Stripe recommends Metronome for new usage-based integrations; Billing Meters remain supported [23] | Reassess tutorials that start every usage build on meters |
| Stripe Managed Payments offers a merchant of record for eligible digital products [25][26] | “Who is the legal seller?” is now a real choice inside Stripe |
| PCI SAQ A changed in 2025 [52][53] | Recheck eligibility and script-security duties |
| The FTC’s 2024 click-to-cancel rule was vacated in July 2025 [54][56] | Don’t quote the 2024 rule as current law; other rules still apply |
| Visa merged fraud and dispute monitoring into VAMP [47][49] | Fraud reports and disputes now count together against one ratio |
What good looks like
- One documented decision on the legal seller: you with Stripe Tax, you with your own tax handling, or Stripe Managed Payments as merchant of record.
- Checkout created on the server through Checkout Sessions, with dynamic payment methods.
- A webhook endpoint that verifies signatures, stores events durably, returns 2xx quickly and processes work from a queue.
- Access derived from a written policy table, not from one status field.
- Billing settings (retries, reminders, cancellation, portal) that match both your retention goals and the law where your customers live.
- Refund, dispute and reconciliation runbooks anyone on the team can follow.
- A support operator can explain any purchase from linked records. An engineer can safely replay failed work. Finance can reconcile funds. A customer can understand and control their subscription.
2. Before you start
Appoint one accountable payments owner. A founder can hold the role, but it must be explicit. Engineering, support, finance and product should know who decides questions that cross their boundaries.
Inputs you need
Business facts. What you sell (SaaS, digital download, physical goods, services, usage-based API). Where your legal entity is established. Where your customers are. B2B, B2C or both. Expected volume and average order value.
Access. Stripe account owner or administrator role. The ability to create sandboxes and restricted keys. Access to your secrets vault, DNS, hosting and the app’s database.
Data. Your current product and price list. Existing customers, subscriptions and saved payment methods if you are migrating. Your refund policy and terms of service. Existing invoices, payment records and reconciliation reports.
Intake checklist
- Legal seller, entity country, Stripe account country and tax IDs recorded
- Each product described in one line, with its delivery mechanism (needed for tax codes)
- Launch markets and deliberately excluded markets listed
- Customer geography for the last 12 months, or a forecast if new
- Consumer versus business sales distinguished
- Direct sale versus routing money to other sellers decided
- Billing model chosen: one-time, flat recurring, seats, usage-based or mixed
- Presentment and settlement currencies recorded
- Tax-inclusive or tax-exclusive display decided by market
- Trial, renewal, cancellation and refund promises written and approved by whoever owns legal risk
- The app account or workspace that owns purchases identified
- Stripe account access with MFA enabled for every team member
- A sandbox for development and a separate sandbox for CI [7][21]
- Existing API versions, SDK versions and webhook destinations inventoried
- Secrets vault or environment store for keys
- Database plan for customers, subscriptions, orders, entitlements and processed events
- Queue or background job system for webhook processing
- Domain for success and return URLs
- Statement descriptor chosen (a brand name customers will recognize)
- Support email and URL for receipts
- Named owners for refunds, disputes, tax registrations and reconciliation
- Named approver for live financial changes
- Tax and accounting advisers assigned where needed
- Incident contact defined
The payments contract
Write one page:
Seller:
Stripe account and environment:
Seller model: [ ] Direct + Stripe Tax [ ] Direct, own tax [ ] Managed Payments
Product(s):
Customer type:
Permitted markets:
Billing unit and model:
Currency:
Price and tax display:
Payment collection timing:
Delivery condition:
Trial terms (length, payment method required up front?):
Renewal terms:
Cancellation effective time (immediate / end of period; pause allowed?):
Refund policy (window, partial allowed, approver):
Failed-payment access policy:
Statement descriptor:
Tax owner:
Reconciliation owner:
Production approver:
Open questions:
Date / owner / approved by:
Don’t leave “delivery condition” as “payment complete.” Specify the evidence needed and the exceptions allowed. For example: “Grant the purchased workspace plan after the relevant invoice is paid and the subscription is eligible under our access policy.” If enterprise customers receive service before payment, name that as an approved credit arrangement, not a technical exception.
Access matrix
| Role | Normal access | Needs separate approval |
|---|---|---|
| Developer or coding agent | Code, sandbox, redacted logs | Any live mutation |
| Support operator | Customer lookup, policy guidance | Refunds above delegated limits |
| Finance operator | Reports and reconciliation | Tax submissions, exceptional adjustments |
| Payments owner | Configuration review, incident coordination | High-impact migrations |
| Customer | Their own billing portal | Nothing belonging to other customers |
Keep secrets out of prompts, source control, screenshots and generated reports. Give an agent only the access its current chapter needs.
Record uncertainty. A field marked “unresolved: adviser required” is useful. A plausible guess quietly built into production code is not.
3. The method
Eight steps. Each has a matching part of section 4. Produce the step’s artifact before you move on. When a decision changes, update the contract and the affected tests together.
Step 1. Decide the seller, offer and payment architecture
- What to do: Establish who sells, choose direct selling with Stripe Tax, direct selling with your own tax handling, or Managed Payments, and pick the smallest suitable Stripe integration. Define products, prices, intervals, refund and cancellation policies.
- Why: Tax, disputes, receipts, support duties and compliance scope all follow from this.
- Done when: A signed decision record names the seller model, markets, billing model, integration route and policies, and a reviewer can understand it without reading code.
Step 2. Set up environments, keys and API versioning
- What to do: Create sandboxes, least-privilege restricted keys, access policies on live keys, and a pinned API version. Give agents agent-tagged keys only.
- Why: Many incidents start with an overpowered key or an unplanned version jump [2][7].
- Done when: No service uses an unrestricted secret key, the API version is pinned in code, live keys have access policies, and agent keys are covered by approval rules.
Step 3. Model the catalog, customers and entitlements
- What to do: Define identifiers, billing ownership, money representation and access rules. Map each offer to a versioned Price.
- Why: Payment objects alone don’t describe your product contract.
- Done when: Every purchasable offer maps to a Price per environment and an explicit fulfillment policy.
Step 4. Build a trustworthy checkout
- What to do: Create Checkout Sessions on the server with customer mapping, metadata, automatic tax (if direct), disclosures and idempotency keys. Handle pending and failed states.
- Why: The browser must not decide what is charged or whether access is granted.
- Done when: An authenticated customer can buy each offer in the sandbox without being able to manipulate price, ownership or fulfillment, and each session links to the right internal account.
Step 5. Build durable event handling and fulfillment
- What to do: Verify events, store them durably, queue the work, deduplicate effects, and make fulfillment safe to call many times from both the webhook and the success page.
- Why: Payments are asynchronous. Stripe retries, doesn’t guarantee order, and can send duplicates [10][11].
- Done when: Replaying the same event ten times produces one fulfillment, and delayed or reordered events still produce the correct final state.
Step 6. Build subscriptions, access and recovery
- What to do: Map every subscription state to an access decision. Define trials, plan changes, failed payments and cancellation. Configure retries, reminders and the customer portal.
- Why: Much subscription revenue loss is silent: failed renewals, access that never turns off, cancellations that turn into disputes [13][47].
- Done when: A written access table exists and every row passes a test-clock simulation.
Step 7. Configure tax and customer-rights controls
- What to do: Set product tax codes, tax behavior, registrations and threshold monitoring. Build renewal disclosures, consent records, cancellation and withdrawal paths for your markets.
- Why: Tax calculated without a registration is zero [36]. Subscription law in the US, California, the EU and the UK sets specific consent, reminder and cancellation duties.
- Done when: Each supported market has an owner, an approved treatment and evidence of implementation, and signup and cancel flows pass the controls in 4.7.
Step 8. Run refunds, disputes and reconciliation; test, launch and monitor
- What to do: Write refund and dispute runbooks, handle their events, set an early-fraud-warning rule, reconcile settlement, run the full test matrix, go live and set up metrics.
- Why: Correct collection is only half of financial correctness, and renewals, trials and retries only show up over time [21].
- Done when: Every test-matrix row passes in a sandbox, runbooks and evidence templates exist, live configuration is deployed with named operators, and the first metrics review is on the calendar.
Keep going: the full playbook
- Playbook steps
- Prompts
- Checklist
- Measuring results
- Common mistakes
Book + Claude skill + MCP access. Black Friday 2026 price. Back to the book page
Or start free
4 complete playbooks, the 7-day Claude Code course and a key your AI can use right now. No card.
Free. We email you about new lessons and volumes now and then. Unsubscribe any time.
Your free key
Install (Claude Code, Codex, Gemini CLI)
Other apps: add the MCP server https://playbookmcp.com/mcp with header Authorization: Bearer + your key. Keep this key; it is shown once.