Browser Payment Popup
The Anypay Platform Makes It Super Easy To Profit By Bitcoin In Your App Or Website
Include the Anypay.js browser SDK in your website
1
<script src="https://anypayinc.s3.amazonaws.com/anypay.0.2.0.min.js"></script>
Copied!
Then request payment to one or more recipients, for one or more coins including BTC, BCH, BSV, LTC, DASH. Your app will be automatically notified when payment is complete.

Collecting Payment To Your Anypay Account Addresses

1
anypay.collectPayment({
2
accountId: '1177',
3
amount: 2.00
4
})
5
.once('paid', () => {
6
console.log('Invoice paid');
7
8
setTimeout(() => {
9
anypay.close();
10
11
}, 2000);
12
13
})
Copied!

Collecting Payment For Existing Invoice

If you already have created an invoice using the Anypay Payments API you can provide its uid to the Anypay.js Web SDK to display the pop up user interface to the user like so:
1
// modeal display QR code payment screen to user
2
3
anypay.showInvoice(INVOICE_UID).on('paid', console.log)
Copied!

Multi-Output Payments To Any Addresses

1
2
<script>
3
let invoice = anypay.newPayment({
4
template: [{
5
currency: 'DASH',
6
to: [{
7
currency: 'USD',
8
amount: 150,
9
address: 'XhEh7yEzbJtViSrmJEiJ73CVp1C37j8eW7'
10
}, {
11
currency: 'USD',
12
amount: 10,
13
address: 'XnEw2KjfLVAy1hSXMFWLCcod5X7rLM581p'
14
}]
15
}],
16
options: {
17
webhook: 'https://paypow.com/anypay/webhooks/payments',
18
redirect: 'https://paypow.com/anypay//payments'
19
}
20
21
})
22
23
invoice.once('paid', paidInvoice => {
24
// the invoice was paid, guaranteed perfectly correct!
25
anypay.close() // close iframe popup
26
})
27
</script>
Copied!
1
Copied!
Last modified 8mo ago