Skip to content

Fixed error handling checkout session webhook that doesn't find a transaction - #375

Merged
lukeholder merged 1 commit into
craftcms:5.xfrom
FosterCommerce:5.x
Oct 13, 2026
Merged

lukeholder merged 1 commit into
craftcms:5.xfrom
FosterCommerce:5.x

Conversation

@sjcallender

Copy link
Copy Markdown
Contributor

Description

We're seeing this error in production on a client's Commerce site:

TypeError: craft\commerce\services\Payments::completePayment(): Argument #1 ($transaction) must be of type craft\commerce\models\Transaction, null given

It's thrown from the payment_intent.succeeded webhook for a checkout session Commerce didn't create. Our client site uses the Payment Intents gateway with paymentFormType: 'elements', so we're assuming the session comes from somewhere else on the same Stripe account.

This applies the existing missing-transaction check to checkout sessions too.

Related issues

@sjcallender
sjcallender requested a review from a team as a code owner October 6, 2026 22:10
@lukeholder

Copy link
Copy Markdown
Member

Thanks for the PR. Will review this tomorrow.

@lukeholder
lukeholder merged commit fdc3827 into craftcms:5.x Oct 13, 2026
@lukeholder

Copy link
Copy Markdown
Member

Will be in the next release. Thanks!

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.

2 participants