diff --git a/server/routes/checkout.js b/server/routes/checkout.js index 2422d2d..d020d69 100644 --- a/server/routes/checkout.js +++ b/server/routes/checkout.js @@ -70,7 +70,7 @@ router.post('/create-session', async (req, res) => { currency: 'usd', product_data: { name: `Carbon Offset - ${tons} tons`, - description: `Portfolio ${portfolioId} at $${pricePerTon}/ton`, + description: `Puffin Portfolio at $${Math.ceil(pricePerTon)}/ton`, // images: ['https://puffinoffset.com/images/carbon-offset.png'], // Optional: Add your logo when available }, unit_amount: baseAmount, // Base amount in cents diff --git a/src/components/OffsetOrder.tsx b/src/components/OffsetOrder.tsx index f53083a..f22be25 100644 --- a/src/components/OffsetOrder.tsx +++ b/src/components/OffsetOrder.tsx @@ -166,8 +166,8 @@ export function OffsetOrder({ tons, monetaryAmount, onBack, calculatorType }: Pr const renderPortfolioPrice = (portfolio: Portfolio) => { try { - // Get the price per ton from the portfolio - const pricePerTon = portfolio.pricePerTon || 18; // Default based on Wren Climate Fund average + // Get the price per ton from the portfolio and round UP to next whole number + const pricePerTon = Math.ceil(portfolio.pricePerTon || 18); return formatCurrency(pricePerTon, currencies.USD); } catch (err) { console.error('Error formatting portfolio price:', err); @@ -175,8 +175,9 @@ export function OffsetOrder({ tons, monetaryAmount, onBack, calculatorType }: Pr } }; - // Calculate offset cost using the portfolio price - const offsetCost = monetaryAmount || (portfolio ? actualOffsetTons * (portfolio.pricePerTon || 18) : 0); + // Calculate offset cost using the portfolio price (rounded UP) + const roundedPricePerTon = portfolio ? Math.ceil(portfolio.pricePerTon || 18) : 18; + const offsetCost = monetaryAmount || (portfolio ? Math.ceil(actualOffsetTons * roundedPricePerTon) : 0); return (