README
Add the following to your page's head tag:
<script src="http://127.0.0.1:8000/anypay.js"></script>
Then, whenever you want to trigger an anypay invoice widget, just call:
anypay.collectPayment({
accountId: '1177',
amount: 0.01
})
.once('loaded', () => {
console.log('Anypay iFrame loaded');
})
.once('canceled', () => {
// This will only fire if the server marks
// the invoice with status: 'canceled'
console.log('Invoice was canceld');
})
.once('underpaid', () => {
console.log('Invoice underpaid');
})
.once('overpaid', () => {
console.log('Invoice overpaid');
setTimeout(() => {
anypay.close();
}, 2000);
})
.once('expired', () => {
console.log('Invoice expired');
})
.once('paid', () => {
console.log('Invoice paid');
setTimeout(() => {
anypay.close();
}, 2000);
})
.once('closed', () => {
console.log('Anypay iFrame closed');
})
}, false);
Then to minimize the anypay.js and anypay.css files, bump the versions and publish to unpkg.com, first run:
npm install
Then run:
./build