Intégration
API impérative
Ouvrez MakePay à partir de votre propre poignée de clic.
Navigateur API
Utilisez le navigateur global API lorsque votre application possède le gestionnaire de clics ou doit transmettre directement les rappels du cycle de vie.
- Ouvrez un mode de paiement avec
window.makepay.showPayment(uid, { onEvent }). - Fermez le modal actuel avec
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>Gestion des rappels
Transmettez un rappel onEvent lorsque votre page doit réagir aux changements de statut de checkout ou rediriger les demandes sans écouter globalement sur window.