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 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-02-13 14:40:27 -07:00
parent e410bd1b0a
commit 6e74f4e360
2 changed files with 8 additions and 6 deletions

View File

@ -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),

View File

@ -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,
}));