Skip to main content

Multi-currency Gateway for Pop-up Integration

When you display the Multi-currency Gateway in a pop-up window, an event will automatically be sent to your website after the payment is completed.

This allows you to listen for the event and handle navigation on the main page, instead of relying on a direct redirect within the pop-up.


🔧 Implementation​

Add the following JavaScript code to your website to listen for and handle the event from the pop-up window:

window.addEventListener("message", function (event) {
if (!event.data?.hc_payment_event || typeof event.data?.hc_payment_event !== "object") return;

// Check the event type
if (event.data.hc_payment_event.event_type === "onChange") {
if (event.data.hc_payment_event.transaction_info.status === "received") {
// Handle your logic here
// E.g: If you want to redirect the main page to the success URL
// window.location.href = event.data.hc_payment_event.redirect_url.success;
}

if (event.data.hc_payment_event.transaction_info.status === "failed") {
// Handle your logic here
}
}
});

✅ Pop-up flow Success​

Pop-up success

â­•ī¸ Pop-up flow Failed​

Pop-up success


â„šī¸ Event Details​

We will send an event containing a JSON object with the following structure:

hc_payment_event {
event_type: string,
redirect_url: { success: string }
transaction_info: {
uuid: string,
status: STATUS,
status_text: string
}
}

STATUS = SUCCESS | FAILED
SUCCESS = "received" | "waiting"
FAILED = "failed" | "in_dispute" | "dispute_lost"
hc_payment_event : {
"event_type": "onChange",
"redirect_url": {
"success": "https://example.com/success"
},
"transaction_info": {
"uuid": "MUNSVk5ZNVY",
"status": "received",
"status_text": ""
}
}