From 96569cda8d7ae7615bc730e7d12a7b331eb313e4 Mon Sep 17 00:00:00 2001 From: Tom Schneider-Swales Date: Wed, 21 Feb 2024 14:24:04 +0100 Subject: [PATCH] Hide payment methods in case of global error in onBeforeError callback --- docs/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/index.js b/docs/index.js index 15bf3f8..480470a 100644 --- a/docs/index.js +++ b/docs/index.js @@ -150,6 +150,7 @@ async function initPayment() { preload: ["cards"], // loads cards script as soon as page loads so that rendering using dropIn is fast onBeforeError: async(_checkout, componentName, errorData) => { console.error("On before error called",_checkout, componentName, errorData); + document.getElementById("payment-methods").style.display = "none"; const message = document.getElementById("custom-override-message"); message.innerHTML = `onBeforeError called in ${componentName}`; message.style = "background-color: red; display: flex;"; @@ -177,7 +178,7 @@ async function initPayment() { // Initialises the SDK const checkout = await new Payoneer.CheckoutWeb(configs); - + document.getElementById("loading-message").style.display = "none"; if(checkout.state === "LOADED") {