SDK Events
Payment elements expose events through paymentElement.on(eventName, handler).
Event names
| Event | When it fires |
|---|---|
ready | Iframe reports ready. |
change | User input or validation state changed. |
focus | Element gained focus. |
blur | Element lost focus. |
escape | Escape key. |
clickTriggered | Click on a payment control. |
completeDoThis | Completion step in multi-step flows. |
confirmTriggered | Confirm action initiated from the form. |
oneClickConfirmTriggered | One-click confirm path. |
Handlers receive an optional event data object (e.g. fields such as elementType and event-specific payloads for ready, focus, blur, clickTriggered, confirmTriggered).
Usage
const paymentElement = elements.create("payment", {});
paymentElement.mount("#payment-form");
paymentElement.on("ready", (event) => {
console.log("ready", event);
});
paymentElement.on("change", (event) => {
if (event && event.complete) {
document.getElementById("pay-button").disabled = false;
}
});
paymentElement.on("focus", () => {
document.getElementById("payment-form").classList.add("focused");
});
paymentElement.on("blur", () => {
document.getElementById("payment-form").classList.remove("focused");
});
Removing listeners
Pass null or undefined as the handler to remove the listener for that event:
paymentElement.on("change", null);
Server-side events (webhooks)
The table above lists in-browser SDK events (ready, change, etc.). For server-side payment lifecycle notifications, use Webhooks: event_type values such as payment_succeeded, payment_failed, payment_processing, and refund_succeeded (snake_case). Verify the TensorRail-Signature header, which carries t=<timestamp>,v1=<hex>: v1 is HMAC-SHA512(your_signing_secret, "<t>.<raw_request_body>") — the timestamp and a dot are prefixed to the body before hashing. Full recipe in Webhooks. Do not confuse these with iframe/SDK event names.