From 6e74f4e36024d3a08151e57c13ab2c239cb26c27 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Fri, 13 Feb 2026 14:40:27 -0700 Subject: [PATCH] Fix PayPal MULTI_CURRENCY_ORDER error by using consistent GBP All store items are priced in GBP (filtered by price_gbp > 0). Hardcode GBP currency throughout the checkout and order creation flow to prevent currency mismatches between the PayPal SDK, order items, and purchase unit amounts. Co-Authored-By: Claude Opus 4.6 --- frontend/src/app/api/orders/create/route.ts | 7 ++++--- frontend/src/app/checkout/page.tsx | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/api/orders/create/route.ts b/frontend/src/app/api/orders/create/route.ts index 2ee7702..1fcbf6b 100644 --- a/frontend/src/app/api/orders/create/route.ts +++ b/frontend/src/app/api/orders/create/route.ts @@ -59,8 +59,9 @@ export async function POST(request: NextRequest) { } // Calculate total with shipping + // All store items are priced in GBP (store filters by price_gbp > 0) const subtotal = items.reduce((sum, item) => sum + item.price * item.quantity, 0); - const currency = items[0].currency; + const currency = 'GBP'; const shippingCost = getShippingCost(shipping.country, currency); const total = subtotal + shippingCost; @@ -94,11 +95,11 @@ export async function POST(request: NextRequest) { })), ); - // Create PayPal order + // Create PayPal order — all items use the same currency const paypalItems: PayPalItem[] = items.map(item => ({ name: item.artworkName, unit_amount: { - currency_code: item.currency, + currency_code: currency, value: item.price.toFixed(2), }, quantity: String(item.quantity), diff --git a/frontend/src/app/checkout/page.tsx b/frontend/src/app/checkout/page.tsx index 18824df..4203458 100644 --- a/frontend/src/app/checkout/page.tsx +++ b/frontend/src/app/checkout/page.tsx @@ -45,8 +45,9 @@ export default function CheckoutPage() { setFormValid(required.every(f => updated[f].trim() !== '')); }; - const currency = items[0]?.artwork?.currency || 'GBP'; - const currencySymbol = currency === 'GBP' ? '\u00a3' : '$'; + // All store items are priced in GBP + const currency = 'GBP'; + const currencySymbol = '\u00a3'; const shippingCost = getShippingCost(formData.country, currency); const total = subtotal + shippingCost; @@ -54,7 +55,7 @@ export default function CheckoutPage() { artworkId: parseInt(item.id), artworkName: item.title, price: item.price, - currency: item.artwork.currency || 'GBP', + currency: 'GBP', quantity: item.quantity, }));