Hi everyone !
I am trying to set up a third party payment gateway on a website. I am using an HTML embed element, and I wrote the following code in order to pass the formToken ( that I sucessfully retrieved previously) into the DIV element with the id " formulaire ".
I tried this method, however it’s not working since I get the message “No formToken”. I know that the value is passed correctly to the HTML element, and I know that it’s a string already, so it seems that the problem comes from the part with the red arrow :
<html>
<head>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script
src="https://static.osb.pf/static/js/krypton-client/V4.0/stable/kr-payment-form.min.js"
kr-public-key="58739933:testpublickey_NUFA6m8QLqEaHktbQ1TkA7Z596H8KEFCiKOaO4871cZCH"
kr-post-url-success="paid.html">
</script>
<link rel="stylesheet"
href="https://static.osb.pf/static/js/krypton-client/V4.0/ext/classic-reset.css">
<script
src="https://static.osb.pf/static/js/krypton-client/V4.0/ext/classic.js">
</script>
<script type="text/javascript">
window.onmessage = (event) => {
if (event.data) {
var form = document.getElementById("formulaire");
//problem -----> form.setAttribute("kr-form-token", event.data);
}
};
</script>
</head>
<body>
<!-- payment form -->
<div class="kr-embedded" id="formulaire"
kr-form-token = "TOKEN-TO-BE-REPLACED">
<div class="kr-pan"></div>
<div class="kr-expiry"></div>
<div class="kr-security-code"></div>
<button class="kr-payment-button"></button>
<div class="kr-form-error"></div>
</div>
</body>
</html>
If anyone would have the correct way to do it, I would really really be grateful !