medusajs/medusa

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

Open

#14205 opened on Dec 3, 2025

View on GitHub
 (9 comments) (0 reactions) (0 assignees)TypeScript (22,539 stars) (2,090 forks)batch import
good first issuetype: bugversion: 2.0

Description

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

Contributor guide