docs(credits): retire the auto-recharge contract
Contract half of recoupable/chat#1960. Row 1 of that issue's PR matrix.
Automatic off-session credit top-up is being removed from the api: it charged a saved card unless the customer had opted out of a Stripe metadata key they were never told about, collected $0 over 30 days, and minted 2,779 Checkout Sessions across 46 accounts (100% with no customer_email) as a side effect of credit-gated 402s. Per the decision recorded on the issue it is being deleted rather than flipped to opt-in.
This PR lands first because two of the three affected surfaces are published contracts, so the removal is described before it is made.
What changes
Endpoints removed (breaking)
GET /api/accounts/{id}/auto-rechargePATCH /api/accounts/{id}/auto-recharge
Deleted: api-reference/accounts/auto-recharge-get.mdx, api-reference/accounts/auto-recharge-update.mdx, their two docs.json nav entries, the /api/accounts/{id}/auto-recharge path block in openapi/accounts.json, and the three now-orphaned schemas (AccountAutoRechargeResponse, AccountAutoRechargeUpdateRequest, AccountAutoRechargeErrorResponse).
402 envelope changed (breaking) in openapi/{research,social,releases}.json
| Field | Before | After |
|---|---|---|
checkoutUrl | Live Stripe Checkout Session URL, freshly minted on every 402 | Removed |
billingUrl | — | Added. Static link to the Recoup app. A constant, so retrying the gate creates nothing |
declineReason | Present when Stripe declined the saved card | Removed (unreachable once no off-session charge is attempted) |
declineReason is deliberately kept on POST /api/credits/sessions, which is the consented top-up path where a real card decline still happens. open-agents' credits dialog parses that response, not the 402, so it keeps working.
Prose
credits.mdx: the## Automatic top-upsection (decision tree, "When auto top-up doesn't trigger", "Opting out", "Tuning") is replaced by## Running out of credits, plus a migration<Note>for callers reading the removed fields. The## 402 Payment Requiredtable and "How to react" guidance are rewritten aroundbillingUrl.- The
POST /api/subscriptions/card-on-filedescription said saving a card meant an account "can be auto-recharged instead of dead-ending" — corrected to point atPOST /api/credits/sessionsand to state explicitly that saving a card does not authorize an automatic charge.
Verification
- All four OpenAPI specs parse (
json.load) after editing; edits were made as anchored text edits rather than a load/dump round-trip, becauseaccounts.json,social.jsonandreleases.jsondo not round-trip byte-for-byte throughjson.dumps(indent=2)(unicode escaping and compactsecurityarrays). The diff is purely deletions plus the changed description strings. grep -rn "auto-recharge\|checkoutUrl\|auto top-up"over all.mdxanddocs.jsonreturns only the intentional migration references in the new<Note>and thebillingUrlfield descriptions.- No page still links the two deleted reference pages, and
#opting-out, the only in-page anchor into the removed section, has no remaining referrer.
Merge order
Merge before the api PRs that implement it. The api side is tracked as rows 3 and 4 of chat#1960.
Summary by cubic
Retires the automatic credit top-up contract and makes 402 insufficient-credits responses static. Previously, gates could charge a saved card and minted a Stripe Checkout Session on every 402; now they never charge automatically and return a constant billingUrl. Programmatic top-ups go through POST /api/credits/sessions.
- Removes
GET /api/accounts/{id}/auto-rechargeandPATCH /api/accounts/{id}/auto-recharge, their reference pages, nav entries, and related schemas inopenapi/accounts.json. - Changes the 402 envelope in
openapi/research.json,openapi/social.json, andopenapi/releases.json: replacecheckoutUrlwithbillingUrland dropdeclineReason. No Stripe objects are created on 402. - Keeps
declineReasononPOST /api/credits/sessions. Updates the card-on-file docs to point toPOST /api/credits/sessionsfor charging. - Rewrites
credits.mdxto “Running out of credits”, removes auto-top-up guidance and migration notes;docs.jsonremoves links to deleted pages.
Migration
- Stop calling the deleted auto-recharge endpoints.
- Read
billingUrlinstead ofcheckoutUrlon 402; do not expectdeclineReasonon 402. - Use
POST /api/credits/sessionsto buy credits. ParsedeclineReasonthere and open itsurlfor Checkout when present. - Do not rely on off-session charging. A saved card is charged only when you request a top-up.
- Merge before API implementations to keep published contracts in sync.
Summary by CodeRabbit
-
Documentation
- Updated credit guidance to clarify that top-ups and administrative grants are handled explicitly.
- Insufficient-credit requests now return an immediate error with a billing link for purchasing credits.
- Clarified that failed requests do not create automatic charges or checkout sessions.
- Updated billing navigation and removed auto-recharge documentation.
-
API Reference
- Replaced checkout links and decline details with a static billing link in insufficient-credit responses.
- Removed auto-recharge endpoints and related response definitions.
- Clarified that saved payment methods support later credit top-ups.