-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[Bug]: processPaymentWorkflow fails capturing payment when executed via stripe payment webhook #9998
Comments
@carlos-r-l-rodrigues |
Not yet, but we'll investigate this issue tomorrow and the fix will very likely be part of that same PR. |
What: When `autocapture` is enabled, the webhook is processed before the order was created. The payment processing workflows were merged into a single one FIXES: SUP-118, SUP-9 #9998
@MiguelFranken I will close this issue because according to our tests the PR is solving all the issues related to payment. Thanks |
Still get errors after updating to 2.0.6:
|
Stack trace (when using local event bus) points to an error from the "PaymentModuleService.capturePayment_" method. fyi: |
Package.json file
Node.js version
20
Database and its version
16.2
Operating system name and version
Mac OS (Latest)
Browser name
No response
What happended?
I’m setting up Stripe as a payment provider in Medusa, aiming to enable automatic payment method selection and automatic capture.
Configuration:
The intent with this setup is to allow payment methods to be managed directly within the Stripe dashboard. I’m specifically testing PayPal over Stripe but am encountering errors on the
payment_intent.succeeded
event from Stripe.I expect this configuration to create (at the end) an order automatically once the payment intent is successfully captured (in Medusa), allowing me to avoid a separate frontend-triggered
createOrder
call (like in the Medusa NextJS Starter).Creating an order from the frontend is also not an option for PayPal via Stripe as we get redirected.
The goal is to handle the entire payment and order flow through Stripe webhooks and not calling the createOrder SDK method in the frontend to enable stripe payment methods that need a redirect to another site.
Development:
I use the following command to listen to Stripe webhooks locally:
So I am using the default Stripe provider (not one of the others for iDEAL, etc.)
The webhook secret returned from this command is configured in my Medusa setup.
Issue:
All Stripe events seem to process correctly, except the
payment_intent.succeeded
event, which throws the following error:Stack (Pretty Printed):
Note:
I was only able to get this error by changing the log mechanism in the event bus subscribe method.
See issue: #9997
Upon inspecting the webhook payload, I noticed a
session_id
withindata.object.metadata.session_id
, confirming this field is present in the event data. However, I do not find a correspondingsessionId
entry in thepayment
table in my database.Let me know if there’s any further detail you’d like added!
Expected behavior
processPaymentWorkflow does not fail capturing payments when executed via stripe payment webhook
Actual behavior
processPaymentWorkflow fails capturing payment when executed via stripe payment webhook
Link to reproduction repo
/
The text was updated successfully, but these errors were encountered: