feat(revenue): Stripe refunds and net revenue tiles - #37
Merged
Conversation
…ucts Refunds live on PaymentIntents, not Checkout Sessions, so refunds from /v1/refunds are attributed to the one-off product via the session's payment_intent — with a capped per-refund session lookup for refunds whose purchase predates the 60-day sessions window. The one-off row gains Refunds and Net revenue tiles; a key without the Refunds read grant degrades to the old gross-only tiles with a hint instead of failing the panel. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
The one-off product row on the Revenue page now reports refunds — prompted by a live test order that was refunded and still showed as $9 revenue.
listRefunds(created[gte])andgetOneOffPurchaseByPaymentIntent; sessions now carry theirpayment_intent.STRIPE_SECRET_KEYwithout the Refunds → Read grant gets the old gross-only tiles plus a hint, not an error. Docs updated (.env.example, setup card, spec 0014).get_stripe_revenueMCP output includes refunds/net (or notes the missing grant).Testing
🤖 Generated with Claude Code