medusa
                                
                                 medusa copied to clipboard
                                
                                    medusa copied to clipboard
                            
                            
                            
                        [Bug]: Stripe Payment succeeds but no order in Medusa Admin Panel - Stripe Payment Element
Package.json file
{
  "name": "medusa-starter-default",
  "version": "0.0.1",
  "description": "A starter for Medusa projects.",
  "author": "Medusa (https://medusajs.com)",
  "license": "MIT",
  "keywords": [
    "sqlite",
    "postgres",
    "typescript",
    "ecommerce",
    "headless",
    "medusa"
  ],
  "scripts": {
    "build": "medusa build",
    "start": "medusa start",
    "dev": "medusa develop",
    "predeploy": "medusa db:migrate",
    "test:integration:http": "TEST_TYPE=integration:http NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit",
    "test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit",
    "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit"
  },
  "dependencies": {
    "@medusajs/admin-sdk": "2.8.4",
    "@medusajs/cli": "2.8.4",
    "@medusajs/framework": "2.8.4",
    "@medusajs/medusa": "2.8.4",
    "@mikro-orm/core": "6.4.3",
    "@mikro-orm/knex": "6.4.3",
    "@mikro-orm/migrations": "6.4.3",
    "@mikro-orm/postgresql": "6.4.3",
    "@tanstack/react-query": "^5.64.1",
    "@tiptap/extension-link": "^2.11.2",
    "@tiptap/extension-text-style": "^2.11.0",
    "@tiptap/extension-underline": "^2.11.2",
    "@tiptap/pm": "^2.11.0",
    "@tiptap/react": "^2.11.0",
    "@tiptap/starter-kit": "^2.11.0",
    "awilix": "^8.0.1",
    "compressorjs": "^1.2.1",
    "lodash": "^4.17.21",
    "lodash.debounce": "^4.0.8",
    "lucide-react": "^0.469.0",
    "motion": "^12.0.1",
    "multer": "^1.4.5-lts.1",
    "pg": "^8.13.0",
    "prettier": "^2.8.0",
    "prettier-plugin-tailwindcss": "^0.0.0-insiders.d539a72",
    "react-quill": "^2.0.0"
  },
  "devDependencies": {
    "@medusajs/test-utils": "2.8.4",
    "@mikro-orm/cli": "6.4.3",
    "@swc/core": "^1.5.7",
    "@swc/jest": "^0.2.36",
    "@types/jest": "^29.5.13",
    "@types/lodash": "^4.17.14",
    "@types/multer": "^1.4.12",
    "@types/node": "^20.0.0",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "jest": "^29.7.0",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "vite": "^5.2.11",
    "yalc": "^1.0.0-pre.53"
  },
  "engines": {
    "node": ">=20"
  }
}
Node.js version
v20.19.2
Database and its version
Postgres 16 alpine
Operating system name and version
Ubuntu 24.04 with Coolify
Browser name
Chrome
What happended?
Describe the issue
I'm experiencing an issue with the Stripe Payment Element integration in Medusa (v2.8.4). In some cases, even though the Stripe payment completes successfully (funds are captured), the corresponding order does not appear in the Medusa admin panel.
🔁 Reproduction Steps (Tested on Medusa v2.7.1)
In a test environment (Medusa v2.7.1), I used test emails recommended by Stripe to simulate various payment errors:
- .*customer_timeout@.*
- .*blik_timeout@.*
- .*invalid_code@.*
Behavior:
- For .*invalid_code@.*, everything worked correctly: an error was shown, and the user could retry the payment.
- For .*customer_timeout@.*and.*blik_timeout@.*, the user was kicked out of checkout with the error: Payment session does not exist. After returning to the cart and retrying the payment, if the payment succeeded, funds appeared in Stripe - but the order never appeared in Medusa.
✅ After Updating to v2.8.4
- The Payment session does not exist error still occurs, but retrying the checkout now results in a successful payment and the order appears in Medusa.
- In Stripe, the previous failed PaymentIntent is shown as automatically canceled.
- I've noticed skipped order IDs (e.g., jumping from order 60 to 62), suggesting that interrupted attempts are partially processed or reserved.
❌ Ongoing Issue: Successful Payment But No Order
Despite improvements in v2.8.4, the bug still occurs intermittently. Example (from June 19, 2025):
- Stripe payment succeeded
- Funds were captured
- No order appeared in Medusa admin
Stripe Dashboard Log:
A request to create a PaymentIntent completed  
A new payment pi_xxx for PLN 100.00 was created  
A request to confirm a PaymentIntent pi_xxx completed  
The payment pi_xxx requires you to take action...  
The payment pi_xxx has succeeded  
py_xxx was charged PLN 100.00
No order in Medusa.
🛠 Manual Completion (Workaround)
I was able to manually "unlock" the order by calling:
curl -X POST 'https://name.com/store/carts/cart_xxx/complete' \
  -H 'x-publishable-api-key: pk_xxx'
After this:
- The order appeared in Medusa
- A new line in Stripe logs showed:
- A request to capture a PaymentIntent pi_xxx failed
 
Stripe responded with:
POST /v1/payment_intents/pi_xxx/capture → 400 - payment_intent_unexpected_state
!!! At this point it should be noted that this error is a "confirmation" of correct payment and placing the order. There is no error => something must have gone wrong !!!
🔎 Additional Notes
In earlier versions (e.g., v2.7.1), manually completing a cart would instead return:
"error": {
  "message": "More information is required for payment",
  "name": "Error",
  "type": "payment_requires_more_error"
}
With payment session details
"status": "requires_action",
"next_action": {
  "type": "redirect_to_url",
  "redirect_to_url": {
    "url": "https://pm-redirects.stripe.com/authorize/acct_xxx/pa_nonce_xxx",
    "return_url": "https://name.com/api/capture-payment/cart_xxx"
  }
}
I would like to point out right away that I am using Next js Medusa Starter and I have extended it according to this tutorial.
Expected behavior
After a successful Stripe payment (i.e., funds received in the Stripe account), Medusa should always:
- Receive and verify the Stripe webhook event
- Trigger the necessary internal actions
- Create the corresponding order in the system
- Display the order in the Medusa admin panel
Actual behavior
- Stripe confirms that the payment was successful (funds were captured), but Medusa sometimes fails to create the order.
- Manually calling POST /store/carts/{cart_id}/completeresolves the issue - the order appears in the admin panel and Stripe logs show a capture attempt - but this indicates that the automatic webhook → complete flow is not triggered as expected.
Link to reproduction repo
I can do it if necessary, but that's Medusa Starter and the tutorial I mentioned