Payment Errors
Last updated
{
"message": "operator_payment_error_handled",
"data": {
"action": "OPERATOR_ERROR",
"message": "Your account has insufficient funds. Please top up to continue."
}
}window.addEventListener("message", (event) => {
// Validate origin
if (event.origin !== "https://game.thndr-cdn.com") return;
let msg;
try {
msg = JSON.parse(event.data);
} catch (e) {
return;
}
if (msg.message.endsWith("operator_handle_payment_error")) {
const error = msg.data?.error;
// Inspect the error and decide how to respond
const response = {
message: "operator_payment_error_handled",
data: {
action: "RETRY", // Replace with your logic
},
};
const iframe = document.getElementById("thndr-iframe");
iframe.contentWindow.postMessage(
JSON.stringify(response),
"https://game.thndr-cdn.com"
);
}
});