Repository navigation
fix: refunds lower the fee-free counter; renewals follow the Stripe customer ID - #223
Merged
Merged
Conversation
…Stripe customer ID Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…tches Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
sonpiaz
marked this pull request as ready for review
October 24, 2026 16:05
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two public claims contradicted the runtime. This PR corrects them on every page that states them, and retires the old refund wording in CI.
1. Refunds and the $10,000 fee-free tier
Old: refunds do not lower the revenue counted toward the $10,000 fee-free tier.
Code: a refund lowers
program.total_revenue(the fee-tier input) by the refunded amount, capped by what that sale added; a full refund takes the remainder.apps/cms/src/api/affiliate-commission/services/commission-refund.ts(uncountRevenue, amount'all'when full, else the refund delta)apps/cms/src/utils/revenue-counter.ts(header:total_revenueis the input to the $10k free tier; every decrement is capped by the sale'srevenue_counted)apps/cms/src/api/affiliate-fee/services/affiliate-fee.ts(Tier 1 $0 to $10K free)Pages:
getting-started/pricing-performance-model.mdx,brand/quickstart/commission-approval-cash-flow.mdx,faq/index.mdx. Newscripts/retired-claims.jsonentry blocks the old sentence.2. How renewals are matched
Old: after the first attributed payment, renewals match by the buyer's email or the saved Stripe customer ID.
Code: the lookup chain tries the click, then
email_hash, thenstripe_customer_id. The email step finds a customer only when itsemail_hashwas recorded, which a settled lead does (processLead); a provisional browser lead deliberately writes no identity. The Stripe customer ID is saved on the customer once a payment is attributed.apps/cms/src/api/webhook-distributor/services/webhook-distributor.ts(lookup chain,email_hashfilter,stripe_customer_idsaved)apps/cms/src/api/affiliate-lead-event/services/affiliate-lead-event.ts(recordProvisionalLeadwrites noemail_hash;processLeadsets it)Pages:
brand/tracking/payment-tracking-stripe.mdx(three lines),api-reference/attribution.mdx,use-cases/subscriptions.mdx. Renewals now say they follow the saved Stripe customer ID; email is described as matching only a customer whose email Affitor has recorded.Not changed (still true): integration pages that say a subscription without
subscription_data.metadatais attributed "only if the buyer's email or Stripe customer ID matches" a known customer.Checks
npm run build,check-agent-surface(retired claims 24 patterns, 0 hits),check-docs-host,check-docs-host-http: all pass locally. No media changed.