Skip to content

feat(minting): handle charge.refunded to revoke license#529

Merged
blove merged 1 commit into
mainfrom
claude/minting-refund-handler
May 22, 2026
Merged

feat(minting): handle charge.refunded to revoke license#529
blove merged 1 commit into
mainfrom
claude/minting-refund-handler

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 22, 2026

Summary

  • Adds charge.refunded to the minting webhook switch
  • Looks up the license by payment_intent, calls revokeLicense, sends a revocation email via Resend
  • Both partial and full refunds revoke (any refund = customer wants out)
  • Disputes (charge.dispute.*) are intentionally deferred to a later PR

Why

Today refunds silently leave licenses valid — the customer keeps full access after Stripe pulls the money back. Required hygiene before live-mode cutover.

Stripe config

Live webhook endpoint already updated to subscribe to charge.refunded.

Test plan

  • Unit: handleChargeRefunded happy path, no-license, no-payment_intent
  • Unit: handleEvent dispatches charge.refunded correctly
  • Smoke: refund the test license created yesterday, confirm DB revoked_at set + revocation email lands

🤖 Generated with Claude Code

When a Stripe charge is refunded (partial or full), look up the license
by payment_intent, revoke it in the DB, and send a revocation email via
Resend. Idempotent under processed_events.

Disputes are not handled in this PR — only charge.refunded.

Run-book:
  - Stripe webhook endpoint we_1TZcsHGYRsLErhxbdN2JTFTr now subscribes
    to charge.refunded in addition to checkout.session.completed.

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

vercel Bot commented May 22, 2026

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

Project Deployment Actions Updated (UTC)
threadplane Building Building Preview, Comment May 22, 2026 4:47pm

Request Review

@blove blove merged commit 3703684 into main May 22, 2026
21 of 22 checks passed
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