PayMe hosted fields example
HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>PayMe client info implementation</title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://cdn.paymeservice.com/hf/v1/hostedfields-staging.js"></script>
</head>
<body>
<div> </div>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-8 col-sm-offset-2">
<div class="panel panel-default credit-card-box">
<div class="panel-body">
<form role="form" id="checkout-form">
<div class="row">
<div class="col-xs-12">
<button class="subscribe btn btn-success btn-lg btn-block" id="submit-button" disabled>
Hash client data
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<hr>
<pre id="console-pre"></pre>
</body>
</html>
JavaScript
const isTestMode = true;
// HELPERS ---------------------------------------------------------------------------------
const consolePre = document.getElementById('console-pre');
const form = document.getElementById('checkout-form');
// -----------------------------------------------------------------------------------------------------------------
const submitButton = document.getElementById('submit-button');
submitButton.disabled = true;
// -----------------------------------------------------------------------------------------------------------------
form.addEventListener('submit', ev => {
ev.preventDefault();
PayMe.clientData(isTestMode).then(data => {
consolePre.innerText = consolePre.innerText + JSON.stringify(data, null, 2);
}).catch(err => console.error(err))
});
submitButton.disabled = false;