<script src="https://payment.tmtprotects.com/tmt-payment-modal.3.6.1.js"></script> <script> window.tmtPaymentModalReady = function () { var tmtPaymentModal = new window.tmtPaymentModalSdk({ path: "tmt-test", formId: "tmt-payment-form", environment: "test" }) // Available Callbacks tmtPaymentModal.on("token_error", function(data) { console.log("TOKEN ERROR - ", data); }) tmtPaymentModal.on("booking_logged", function(data) { console.log("BOOKING LOGGED - ", data); }) tmtPaymentModal.on("booking_exists", function (data) { console.log("BOOKING EXISTS - ", data); }) tmtPaymentModal.on("booking_error", function (data) { console.log("BOOKING ERROR - ", data); }) tmtPaymentModal.on("transaction_logged", function (data) { console.log("TRANSACTION LOGGED - ", data); tmtPaymentModal.closeModal(); // Get the transaction ID and add to a hidden input. var idEl = document.getElementById("tmt_id"); idEl.value = data.id; // Get the transaction status and add to a hidden input. var idEl = document.getElementById("tmt_status"); idEl.value = data.status; // Get the transaction hash and add to a hidden input. var idEl = document.getElementById("tmt_hash"); idEl.value = data.hash; // Submit form to validate hash prior to completion page. var form = document.getElementById("tmt-payment-form"); form.submit(); }) tmtPaymentModal.on("transaction_failed", function (data) { console.log("TRANSACTION FAILED - ", data); tmtPaymentModal.closeModal(); // Get the transaction ID and add to a hidden input. var idEl = document.getElementById("tmt_id"); idEl.value = data.id; // Get the transaction status and add to a hidden input. var idEl = document.getElementById("tmt_status"); idEl.value = data.status; // Get the transaction hash and add to a hidden input. var idEl = document.getElementById("tmt_hash"); idEl.value = data.hash; // Submit form to validate hash prior to completion page. var form = document.getElementById("tmt-payment-form"); form.submit(); }) tmtPaymentModal.on("transaction_timeout", function (data) { console.log("TRANSACTION TIMEOUT - ", data); }) tmtPaymentModal.on("transaction_error", function (data) { console.log("TRANSACTION ERROR - ", data); }) tmtPaymentModal.on("modal_closed", function (data) { console.log("MODAL ClOSED - ", data); }) tmtPaymentModal.on("transaction_result_available", function (data) { console.log("TRANSACTION RESULT AVAILABLE - ", data); }) tmtPaymentModal.on("close_window_attempted", function (data) { console.log("USER ATTEMPTED TO CLOSE BROWSER WINDOW ", data); }) } </script>