medusajs/medusa

[Bug]: Stripe webhook triggers multiple (unnecessary) premature cart completion on Payment Intent creation

Open

#14.205 aperta il 3 dic 2025

Vedi su GitHub
 (11 commenti) (0 reazioni) (0 assegnatari)TypeScript (2090 fork)batch import
Stalegood first issuetype: bugversion: 2.0

Metriche repository

Star
 (22.539 star)
Metriche merge PR
 (Merge medio 10g 22h) (185 PR mergiate in 30 g)

Descrizione

Package.json file

latest version

Node.js version

v21

Database and its version

17

Operating system name and version

Linux

Browser name

No response

What happended?

When using the Stripe Payment Element, a payment_intent is often created or updated to a processing state before the actual payment authorization is finalized. Currently, the payment webhook handler attempts to complete the cart immediately upon receiving these initial webhook events.

Since the payment is not yet fully authorized/captured, the Cart Completion workflow triggers, creates an Order (incrementing the display_id), and then fails/reverts when it realizes the payment isn't ready. (in the authorize-payment-session-step)

This leads to:

  • Reverted Workflows: Unnecessary load on the server triggering workflows that are destined to fail with a lot of unnessary large queries.

  • Order ID Gaps: The most significant side effect is that the internal display_id (Order Number) increments during the initial workflow step before the transaction reverts. This results in gaps in Order IDs (e.g., Order 1001, then 1003) which is confusing for merchants and problematic for accounting/monitoring.

Expected behavior

We should only trigger cart completion on definitive actions (like AUTHORIZED or CAPTURED) in the webhook.

Actual behavior

n/a

Link to reproduction repo

not needed

Guida contributor