Skip to content

Commit

Permalink
Hide payment methods in case of global error in onBeforeError callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Schneider-Swales committed Feb 21, 2024
1 parent ce15389 commit 96569cd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;";
Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit 96569cd

Please sign in to comment.