0.1.8 • Published 5 years ago

anypay-widget v0.1.8

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

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
0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago