collect-africa-js
Version:
Collect Africa Checkout library
39 lines (36 loc) • 949 B
HTML
<html>
<head>
<script src="./collect-widget.js"></script>
</head>
<body>
<h1>Test payview</h1>
<button onclick="openCollectAfrica()">Pay 100 NGN</button>
</body>
<script>
function openCollectAfrica() {
const checkout = new CollectCheckout({
email: 'peter@parker.com',
firstName: 'Peter',
lastName: 'Parker',
reference: generateReference(),
amount: 10000,
currency: 'NGN',
// itemImage: '/development/shoe.png',
publicKey: 'pk_sandbox_xxxxxxxxxxxxxx',
onSuccess: function (e) {
console.log('Transaction success.', e);
},
onClose: function (e) {
console.log('user closed the widget.', e);
},
});
checkout.setup();
checkout.open();
}
function generateReference() {
let date = new Date();
return date.getTime().toString();
}
</script>
</html>