@collectapp/checkout-sdk
Version:
Collect Africa Checkout library
40 lines (37 loc) • 1.03 kB
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: 0.1,
currency: 'NGN',
// itemImage: '/development/shoe.png',
publicKey: 'pk_sandbox_jl7rnr8wdrskywsb4589',
// localUrl: 'http://localhost:8007', // Your local checkout server URL
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>