Stop /course licensing the whole cart and refund plugins one at a time - #547
Merged
Merged
Conversation
The /course checkout added the Masterclass to the buyer's cart and sent Stripe only the cart ID. When the invoice was paid, the webhook job licensed everything in that cart, so plugins and bundles the buyer had not paid for were licensed and their developers got a payout. The course is now a direct purchase. The checkout sends the product ID and never touches the cart, and the job licenses that one product from the invoice. If an earlier checkout left the Masterclass in the buyer's cart, it is removed once they have paid so the cart cannot charge for it again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refunding a plugin license refunded the whole payment, so every other item bought in the same checkout was refunded too while only the one license was revoked. The refund now covers the license's own line of the Stripe checkout, at Stripe's total for that line after coupons and tax. The cart checkout tags each line with its plugin or bundle ID so the line can be found. Checkouts made before that are matched by name. The line item is the idempotency key, so a repeated request gets the same refund back. Co-Authored-By: Claude Opus 5.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.
This fixes two money bugs in checkout. They are separate commits and touch different files.
Buying the Masterclass licensed the buyer's whole cart
The /course checkout added the Masterclass to the buyer's cart and sent Stripe only the cart ID. When the invoice was paid,
HandleInvoicePaidJobfound no list of purchased items and fell back to licensing everything in the cart. Any plugin or bundle sitting in the cart was licensed for free, and third-party developers got a payout for it. #406 was meant to fix this but only added the purchased item list to the cart checkout, not to the course one.The course is now a direct purchase that never touches the cart:
price_paidis the invoice total, so a subscriber's discounted purchase is recorded at what they paid rather than the list price.Refunding one plugin refunded the whole payment
RefundPluginPurchasepassed Stripe only the payment intent, so Stripe refunded everything bought in that checkout while only the one license was revoked.It now refunds the license's own line of the checkout, at Stripe's total for that line after coupons and tax:
Things to watch
The full test suite passes locally (2017 passed, 1 skipped).
🤖 Generated with Claude Code