Recurring Payments
Tokenisation Flow Events
Handle postMessage events during the card tokenisation flow
This page lists events sent from the embedded tokenisation iframe to the parent application, allowing your app to respond to key moments such as tokenisation completion.
Tokenisation Flow Completion Event
When the tokenisation journey inside the iframe is completed, the iframe sends a postMessage event to the parent.
The event is sent after a short delay (approximately 3 seconds) to allow the tokenisation status page to render inside the iframe.
Event Properties
| Property | Value | Type | Description |
|---|---|---|---|
type | TOKENISATION_FLOW_COMPLETED | String | Indicates the tokenisation journey has finished and the iframe can be closed |
tokenisedCardId | e.g. c3e7f8a9-1234-5678-9012-3456789abcde | UUID | The unique identifier for the tokenised card |
Event Listener Example
window.addEventListener("message", (event) => {
if (event.data?.type === "TOKENISATION_FLOW_COMPLETED") {
const { tokenisedCardId } = event.data;
console.log(`Tokenisation completed for card: ${tokenisedCardId}`);
// Close the iframe
const iframe = document.getElementById("tokenisation-iframe");
if (iframe) {
iframe.remove();
}
}
});Example Flow
- The user completes the tokenisation inside the iframe.
- The iframe waits ~3 seconds to allow the status page to render.
- The iframe sends
TOKENISATION_FLOW_COMPLETEDto the parent viawindow.parent.postMessage. - The parent app receives the event and closes the iframe or performs post-tokenisation actions.
Notes
- The parent app is responsible for closing the iframe — the iframe does not remove itself.
- The payload currently contains
tokenisedCardId. Additional metadata may be included in future versions.