From 512368d79e7ae4670b6b194468191a265af9d3a6 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Thu, 26 Mar 2026 21:57:48 +0100 Subject: [PATCH] fix: pass testmode flag to mollie.js based on env var --- lib/mollie.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/mollie.ts b/lib/mollie.ts index e731c8c..b56e85f 100644 --- a/lib/mollie.ts +++ b/lib/mollie.ts @@ -54,9 +54,11 @@ export function initMollie(): MollieInstance | null { if (mollieInstance) return mollieInstance if (typeof window === 'undefined' || !window.Mollie || !MOLLIE_PROFILE_ID) return null - // Mollie auto-detects test/live mode based on the API key configured server-side. + // testmode must match the API key type on the backend (test_ = true, live_ = false) + const testmode = process.env.NEXT_PUBLIC_MOLLIE_TESTMODE === 'true' mollieInstance = window.Mollie(MOLLIE_PROFILE_ID, { locale: 'en_US', + testmode, }) return mollieInstance }