Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Stripe webhooks failing due to missing order_id (manual Payment Links) #1176

Closed
Web10-Joris opened this issue Nov 15, 2024 · 2 comments · Fixed by #1181
Closed

Some Stripe webhooks failing due to missing order_id (manual Payment Links) #1176

Web10-Joris opened this issue Nov 15, 2024 · 2 comments · Fixed by #1181

Comments

@Web10-Joris
Copy link
Contributor

Description

PaymentIntent webhooks from non-Simple Commerce sources (e.g. manually made Payment Links) are throwing errors due to missing order_id in metadata. Can be prevented by adding a check before each method-case and return 2x status code.

[2024-11-15 12:49:05] production.ERROR Undefined array key "order_id" {"exception":"[object] (ErrorException(code: 0): Undefined array key \"order_id\" at /vendor/duncanmcclean/simple-commerce/src/Gateways/Builtin/StripeGateway.php:187)"}

Check if metadata->order_id exist

if (!isset($data['metadata']['order_id'])) {
    return new Response('Webhook received but no order_id found', 202);
}

Steps to reproduce

N/A

Environment

N/A (let me know if needed)

@duncanmcclean
Copy link
Owner

The fix you've suggested looks good to me. Can you open a pull request?

Copy link

Released as part of v7.5.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants