fix: pass testmode flag to mollie.js based on env var

This commit is contained in:
Usman Baig
2026-03-26 21:57:48 +01:00
parent 0f41eb4df4
commit 512368d79e

View File

@@ -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
}