Skip to content

fix: Stripe invoice events, refunded invoices and empty refund token in docs - #203

Merged
sonpiaz merged 3 commits into
mainfrom
fix/stripe-invoice-events
Oct 18, 2026
Merged

sonpiaz merged 3 commits into
mainfrom
fix/stripe-invoice-events

Conversation

@sonpiaz

@sonpiaz sonpiaz commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

What changed

Docs for behavior that went live in affiliate-cms v3.16.139 and v3.16.140 today.

  • Stripe events: invoice.paid is handled together with invoice.payment_succeeded by the same handler, which records each invoice at most once. Every page that named only invoice.payment_succeeded now names both (stripe, connect-stripe-account, payment-tracking-stripe, quickstart-integration, node-express, attribution, errors).
  • Subscriptions use case: a new invoice whose payment was already refunded (even in part) before processing is not recorded as a sale; a new invoice paid by several charges, or by one payment shared with other invoices, is not recorded automatically; some older sales are held for manual reconciliation. Replaces "those are not taken back automatically".
  • Errors: an empty Bearer token on POST /api/v1/track/refund now answers Empty Bearer token (sale still answers Missing API token).
  • Track refund: on a 500, retry the same request with the same refund_id (an applied refund is skipped).
  • Two retired phrasings added to scripts/retired-claims.json.

Why

Runtime changed; the pages described the previous behavior.

Sources (affiliate-cms main)

  • src/api/webhook-distributor/services/webhook-distributor.ts:850-852 (both invoice events share one handler, invoice-locked) and docs/stripe-connect-events.md "Invoice allocation admission before money" (refunded-before-admission cap; split/shared/partial allocations retry and write no sale).
  • src/api/affiliate-tracking/controllers/v1-tracking.ts:1535-1539 (Empty Bearer token), :960 (Missing API token).
  • Refund transaction probe (aborted reversal answers 500, nothing committed); refund_id retries are already documented as safe on the same page.

Left out on purpose: details of non-USD invoice handling (pending a separate decision).

How verified

npm run gen:llms, npm run build, check-agent-surface (retired claims included), check-docs-host, check-docs-host-http: all pass. Independent review (different vendor) passed after three rounds. Claims table in the private workspace.

🤖 Generated with Claude Code

…in docs

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
affitor-docs Ready Ready Preview Oct 18, 2026 5:51pm UTC

Request Review

…e events everywhere

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sonpiaz
sonpiaz merged commit 66ee0d9 into main Oct 18, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 934b7228 Deployed Oct 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant