Payhere embed SDK example
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Embed Test Site</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style type="text/css"> | |
.container { | |
margin: 4rem auto; | |
max-width: 32rem; | |
text-align: center; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<button id="payhere-custom">Pay now</button> | |
</div> | |
<script src="https://payhere.co/embed/embed.js"></script> | |
<script> | |
document.getElementById("payhere-custom").addEventListener("click", () => { | |
console.log("launch payhere embed") | |
PayHere.launch({ | |
embedURL: "https://sandbox.payhere.co/altlabs/cart", | |
amountInCents: 4000, | |
hideAmount: "yes", | |
onSuccess: function({ customerName, customerEmail }) { | |
console.log("onSuccess", customerName, customerEmail) | |
}, | |
onFailure: function(error) { | |
console.log("onFailure", error) | |
}, | |
onClose: function() { | |
console.log("onClose") | |
} | |
}) | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment