bug(plugin-ecommerce): Stripe adapter exceeds 500-char metadata limit
Maintainers usually reply within 1 day
@sarankumar1325 is already working on this.
Since Oct 23, 2026.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- payments
Research direction
Read packages/plugin-ecommerce/src/payments/adapters/stripe/initiatePayment.ts and confirmOrder.ts, then run the reproduction's pnpm test:int for the 12 item cart case. The issue identifies transaction.items as the existing source for order items and describes removing the cart snapshot from Stripe metadata; also consider the address metadata limit it reports. Done means the reproduction passes and checkout can create the order.
Written by the indexing model from the issue text.
Description
Describe the Bug
The ecommerce plugin's Stripe adapter puts the entire cart into PaymentIntent metadata. Stripe caps every metadata value at 500 characters, so a checkout with more than a few cart items fails:
Error: Metadata values can have up to 500 characters, but you passed in a value that is 1090 characters. Invalid value: [{"q...6"}]
initiatePayment.ts sends cartItemsSnapshot: JSON.stringify(flattenedCart). Each item contributes roughly 60 characters (row id, product, quantity, optional variant, plus any custom properties from cartItemMatcher), so the limit is reached at around 8 items, and sooner with MongoDB ObjectIDs or custom item properties. The cart can't be checked out at all; the customer just gets Error initiating payment.
confirmOrder.ts then reads cartItemsSnapshot back from the metadata to create the order's items. That round-trip isn't needed: initiatePayment already stores the same flattenedCart on the transaction (items: flattenedCart), and confirmOrder already loads that transaction. Building the order from transaction.items would let cartItemsSnapshot be dropped from the metadata entirely.
shippingAddress is JSON-stringified into the metadata the same way. A typical address stays under the limit, but an unusually long one would hit the same error.
This affects both v3 and v4: the same code ships in 4.0.0-beta.4 and is on main.
Link to the code that reproduces this issue
Reproduction Steps
- Clone this repo and open the
stripe-adapter-metadata-exceeds-500-chars/directory pnpm installpnpm test:int: the test creates 12 products and a guest cart holding all of them, then callsPOST /api/payments/stripe/initiate.stripeis mocked, and the mock enforces Stripe's 500-character metadata limit with the real API's error message, so no Stripe account is needed.
The request fails with a 500:
ERROR: Error initiating payment with Stripe
err: {
"type": "Error",
"message": "Metadata values can have up to 500 characters, but you passed in a value that is 712 characters.",
}
FAIL tests/int.spec.ts > stripeAdapter initiatePayment > initiates a payment for a cart with 12 items
AssertionError: expected 500 to be 200 // Object.is equality
Which area(s) are affected?
plugin: ecommerce
Environment Info
Relevant Packages:
payload: 3.92.0
@payloadcms/plugin-ecommerce: 3.92.0
@payloadcms/db-sqlite: 3.92.0
stripe: 18.3.0
Node: 22.23.3, pnpm: 11.5.1, darwin arm64
- Dominant language
- TypeScript
- Stars
- 45.5k
- Forks
- 4.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 309
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from payloadcms/payload
-
Grid view: show the file placeholder when a thumbnail image fails to loadPossibly taken @lazerg claimed this today. OpenBug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
payloadcms/payload#19181 ·
Maintainers usually reply within 1 day
-
WhereBuilder throws "Cannot read properties of undefined (reading 'value')" when the list URL filters on a field that is not filterablePossibly taken A pull request linked to this issue is open or already merged. OpenBug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
payloadcms/payload#19002 · 1 comment ·
Maintainers usually reply within 1 day
-
Regression: `findByID` with `disableErrors: true` throws `NotFound` for null/empty ids since 3.91.0Possibly taken @Krrishkumar125 claimed this 7 days ago. Openarea: core Bug invalid-reproduction status: needs-triage v3
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
payloadcms/payload#18935 · 2 comments ·
Maintainers usually reply within 1 day
-
bug: Local API call with req resets req.fallbackLocale to defaultLocalePossibly taken A pull request linked to this issue is open or already merged. Openarea: core Bug created-by: Contributor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
payloadcms/payload#18768 ·
Maintainers usually reply within 1 day
-
[plugin-multi-tenant] Infinite redirect loop with custom tenantFieldName and isGlobal collectionsPossibly taken A pull request linked to this issue is open or already merged. OpenBug plugin: multi-tenant status: needs-triage v3
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
payloadcms/payload#18690 ·
Maintainers usually reply within 1 day
All issues in payloadcms/payload
Similar issues
-
area:plugins area:security area:skills bug has repro
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anthropics/claude-code#105911 ·
Maintainers usually reply within 1 day
-
openspec-apply-change skill: when blocked, may select a ready artifact unrelated to missingArtifactsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Fission-AI/OpenSpec#2165 ·
Maintainers usually reply within 1 day
-
🐞 bug 🧐 unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Tencent/tdesign-vue-next#7032 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gnosis/gnosis_vpn#661 ·
Maintainers usually reply within 1 day
-
content-freshness: staleOwnedContent doc comments still say 'complete receipt' (follow-up to #7912)Opentriage:bug-verified
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 1 day