Repository navigation
Studio: say what Stripe refused, instead of "something went wrong" - #14
Merged
Merged
Conversation
A StripeError thrown outside the founding-coupon retry reached the generic handler, so an owner pressing Upgrade with a price the key can't see — a test price under a live key, say — got a blank 500 and no way to tell a mode mismatch from an outage. Stripe's own message now comes back: a refusal as 400 with its code and param, an outage as 502. Stripe's messages name the object that was asked for, not the key that asked, so nothing secret travels with them. Co-Authored-By: Claude Opus 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.
What was wrong
Pressing Upgrade returned a bare 500. A
StripeErrorthrown anywhere except the founding-coupon retry fell through to the generic handler, so the owner saw "Something went wrong on our side" and the reason was only in the Worker's logs.Stripe's own message now comes back: a refusal as 400 with its
codeandparam, an outage as 502. Stripe's messages name the object that was asked for, not the key that asked, so nothing secret travels with them.What it found
I ran Studio locally against Stripe test mode and did a real checkout. The new message said it immediately:
Not the mode mismatch I had assumed. The products had no
tax_code, and Managed Payments requires one. All four products (test and live, Pro and Team) are nowtxcd_10103001— Software as a service (SaaS), business use.Then the whole loop ran
With the tax code set, a full test-mode purchase went through on localhost:
4242 4242 4242 4242stripe listenforwarded 16 events, every one answered 200plan=pro,plan_status=active,billing_interval=month,seats=1,period_end=2026-10-30, customer storedSo checkout, the webhook, the signature check and the plan update all work against real Stripe.
Checked
86 tests pass, including two new ones: a Stripe refusal returns 400 with the message, code and param; a Stripe outage returns 502.
🤖 Generated with Claude Code