0.0.9 • Published 7 years ago
@confirmo/bitcoin-pay-overlay v0.0.9
BitcoinPay Overlay
Usage
CDN
<script type="text/javascript" src="./bitcoin-pay.js"></script>
<script type="text/javascript">
BitcoinPay.BPayInvoice.open(invoice_url, callback_fnc);
</script>npm module
npm install @confirmo/bitcoin-pay-overlay --saveimport {BPayInvoice} from '@confirmo/bitcoin-pay-overlay';
BPayInvoice.open(invoice_url, callback_fnc);API
import {BPayInvoice} from '@confirmo/bitcoin-pay-overlay';
/**
* Open Bitcoin Pay invoice overlay
*
* @param {string} invoice_url - URL of invoice.
* @param {callback} [callback_fnc] - Optional - callback called when overlay is closed
*
* @example
*
* // URL of invoice created from REST API
* const invoice_url = 'https://bitcoin-pay.demo/#/public/invoice/invv9e1rxdz8';
*
* // Callback called when overlay is closed
* const callback_fnc = () => alert('Overlay has been closed');
* BPayInvoice.open(invoice_url, callback_fnc);
*/
BPayInvoice.open(invoice_url, callback_fnc);
/**
* Closes Bitcoin Pay overlay
*/
BPayInvoice.close();Payment button API
import {BPayButton} from '@confirmo/bitcoin-pay-overlay';
/**
* Create Bitcoin Pay payment button
*/
var button = BPayButton.initialize({
id: 'bp-simple-button',
paymentButtonId: 'pbt16354asde',
buttonType: 'simple',
values: {
amount: 100,
currency: 'LTC',
productName: 'Some cool product',
productDescription: 'Simple description',
reference: 'merchantRef',
returnUrl: 'https://my-cool-eshop.com/?q=this+is+return+url'
}
});
/**
* Remove Bitcoin Pay payment button
*/
button.remove();