diff --git a/app/api/create-checkout-session/route.ts b/app/api/create-checkout-session/route.ts index 2a9095e..ed436f5 100644 --- a/app/api/create-checkout-session/route.ts +++ b/app/api/create-checkout-session/route.ts @@ -13,6 +13,7 @@ function getMollie() { // Dynamic pricing configuration (in EUR) const TICKET_PRICE = 80 // €80 early bird +const PROCESSING_FEE_PERCENT = 0.02 // 2% to cover Mollie payment processing fees // Accommodation prices per person for 7 nights const ACCOMMODATION_PRICES: Record = { @@ -37,18 +38,23 @@ export async function POST(request: NextRequest) { const registrationData = registrationDataStr ? JSON.parse(registrationDataStr) : null - // Calculate total - let total = TICKET_PRICE + // Calculate subtotal + let subtotal = TICKET_PRICE const descriptionParts = ["CCG 2026 Ticket (€80)"] if (includeAccommodation) { const accom = ACCOMMODATION_PRICES[accommodationType] if (accom) { - total += accom.price + subtotal += accom.price descriptionParts.push(`${accom.label} (€${accom.price.toFixed(2)})`) } } + // Add processing fee on top + const processingFee = Math.round(subtotal * PROCESSING_FEE_PERCENT * 100) / 100 + const total = subtotal + processingFee + descriptionParts.push(`Processing fee (€${processingFee.toFixed(2)})`) + // Build metadata for webhook const metadata: Record = {} if (registrationData) { diff --git a/app/register/page.tsx b/app/register/page.tsx index c9bbe6e..33e0a0e 100644 --- a/app/register/page.tsx +++ b/app/register/page.tsx @@ -42,9 +42,11 @@ export default function RegisterPage() { } const accommodationPrice = accommodationPrices[accommodationType]?.price ?? 0 - const totalPrice = + const subtotalPrice = baseTicketPrice + (includeAccommodation ? accommodationPrice : 0) + const processingFee = Math.round(subtotalPrice * 0.02 * 100) / 100 + const totalPrice = subtotalPrice + processingFee const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() @@ -290,6 +292,14 @@ export default function RegisterPage() {

+ {/* Processing fee */} +
+
+
Payment processing fee (2%)
+
+ €{processingFee.toFixed(2)} +
+ {/* Total */}