You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plugin-ecommerce: Stripe adapter hardcodes PaymentIntent amount to cart.subtotal #15784
There is no way to customize this amount, which makes it impossible to include additional costs like shipping fees or apply discounts like gift cards without replacing the entire adapter.
Problem
In a typical e-commerce checkout, the total charged to the customer is:
charge = cart.subtotal + shippingCost - discounts
Since the adapter only uses cart.subtotal, consumers who need to charge shipping or apply gift card discounts are forced to copy the entire Stripe adapter into their project and maintain a custom fork — just to change the amount calculation.
The initiatePayment endpoint already passes through extra fields from the request body to the adapter via data (which accepts [key: string]: any), but the adapter ignores them.
Proposed solution
Add a resolveAmount hook to the adapter config
This lets consumers define how the amount is calculated:
stripeAdapter({secretKey: '...',resolveAmount: ({ cart, data })=>{return(cart.subtotal??0)+(data.shippingCost??0)-(data.giftCardDiscount??0)},})
Use cases
Shipping costs: Charge subtotal + shippingCost (shipping is not a cart item)
Gift cards / vouchers: Reduce the Stripe charge when a gift card covers part of the order
Handling fees, taxes, surcharges: Any cost that isn't a product line item
Current workaround
The only option today is to copy the entire Stripe adapter source into the project and maintain a custom version, which is brittle across plugin updates.
Confirmed at v3.88.0: stripe/initiatePayment.ts line 21 sets const amount = cart.subtotal and passes it to paymentIntents.create with no seam to adjust it, so shipping, tax and order-level discounts cannot reach the charged total.
If a hook along these lines would be acceptable — for example an optional modifyAmount({ amount, cart, req }) on the adapter config, defaulting to the current behaviour — I would be glad to open a PR with tests.
Activity
jentzheng commentedon Mar 30, 2026
My temporary solution is to override the entire Stripe adapter using the Checkout API. I would suggest replacing this part of the code (https://github.com/payloadcms/payload/blob/main/packages/plugin-ecommerce/src/endpoints/confirmOrder.ts#L182-L211
) with a fulfillment module.
Poseidonas commentedon Aug 20, 2026
Confirmed at v3.88.0: stripe/initiatePayment.ts line 21 sets
const amount = cart.subtotaland passes it topaymentIntents.createwith no seam to adjust it, so shipping, tax and order-level discounts cannot reach the charged total.If a hook along these lines would be acceptable — for example an optional
modifyAmount({ amount, cart, req })on the adapter config, defaulting to the current behaviour — I would be glad to open a PR with tests.chore: add six more upstream fixes and regression coverage
fix: address 24 Payload read, schema, version and tooling reports (#9)