import bitcoincomLink from 'bitcoincom-link';
bitcoincomLink.payInvoice({
url: 'bitcoincash:?r=https://bitpay.com/i/LHQmUTjzAcqX1NU47Nk1mJ',
})
.then((data: PayInvoiceOutput) => {
const {
memo,
} = data;
console.log('Payment processed memo from merchant server: ' + memo);
})
.catch(({type: string, description: string, data: any}) => {
switch(type) {
case NO_PROVIDER:
console.log('No provider available.');
break;
case PROTOCOL_ERROR:
console.log('The provided protocol is not supported by this wallet.');
break;
case MERCHANT_ERROR:
console.log('There was an error when sending this transaction to the merchant.');
break;
case MALFORMED_INPUT:
console.log('The input provided is not valid.');
break;
case CANCELED:
console.log('The user has canceled this transaction request.');
break;
}
});