Integration
Imperative API
Open MakePay from your own click handler.
Browser API
Use the global browser API when your application owns the click handler or needs to pass lifecycle callbacks directly.
- Open a payment modal with
window.makepay.showPayment(uid, { onEvent }). - Close the current modal with
window.makepay.hide().
html
<script src="https://makepay.io/modal/makepay.js"></script>
<button type="button" id="pay-with-makepay">Pay with crypto</button>
<script>
document.getElementById("pay-with-makepay").addEventListener("click", function () {
window.makepay.showPayment("YOUR_PAYMENT_UID", {
onEvent: function (event) {
if (event.type === "makepay.payment.redirect_requested" && event.payload.redirectUrl) {
window.location.assign(event.payload.redirectUrl);
}
},
});
});
</script>Callback handling
Pass an onEvent callback when your page needs to react to checkout status changes or redirect requests without listening globally on window.