Skip to content

Fix charge.succeeded webhook crash on removed Charge#subscription - #2114

Merged
jmilljr24 merged 1 commit into
mainfrom
maebeale/fix-error
Aug 9, 2026
Merged

Fix charge.succeeded webhook crash on removed Charge#subscription#2114
jmilljr24 merged 1 commit into
mainfrom
maebeale/fix-error

Conversation

@maebeale

@maebeale maebeale commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 3 Read 📖 one-line webhook guard swap + spec update, contained

What is the goal of this PR and why is this important?

  • Production charge.succeeded webhooks were crashing with NoMethodError: undefined method 'subscription' for #<Stripe::Charge> (Honeybadger), so no ExternalProcessorPayment records were being created.
  • Cause: stripe gem 19.x pins an API version that dropped Charge#subscription.

How did you approach the change?

  • Subscription (membership) charges carry an invoice and are recorded via the membership/invoice flow, so skip them by invoice.present? instead of the removed subscription.
  • Updated the spec double to match a real Stripe::Charge (no subscription method), which reproduced the crash before the fix.

Anything else to add?

  • invoice.present? skips any invoice-backed charge; for this app that's the intended set (membership dues are the only Stripe-invoice flow).

Stripe gem 19.x pins an API version that dropped Charge#subscription, so
every charge.succeeded webhook raised NoMethodError before recording the
payment. Subscription (membership) charges carry an invoice and are handled
via the membership/invoice flow, so detect and skip them by invoice presence
instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 9, 2026 00:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jmilljr24
jmilljr24 marked this pull request as ready for review August 9, 2026 01:48
@jmilljr24
jmilljr24 merged commit 080d358 into main Aug 9, 2026
3 checks passed
@jmilljr24
jmilljr24 deleted the maebeale/fix-error branch August 9, 2026 01:48
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.

3 participants