btcpayserver/node-btcpay

accepting payments via api?

ralyodio opened this issue · 2 comments

I get that I need to create an invoice, but how do I tell if the invoice has been paid?
I'll need to mark the invoice as paid and upgrade the user's account once they have paid?

Also how do I get a qrcode, address and amount.....is that part of the invoice when I create it?

Just redirect the user on the URL of the invoice.
Consider the payment done when the status is confirmed or complete.
You can pass a callback URI if you want to be notified.

It is the same API interface as bitpay.

@chovy sorry this response came late. All the information you need to collect the payment is returned as part of the invoice return data when it is created. You can specify a webhook via a notificationURL parameter when creating the invoice and the webhook will get notified when a payment is received. You may then request further details about the status of the invoice using the BTCPayserver API.

client.create_invoice({price: 10, currency: 'USD', notificationURL: 'https://webhookurl'})
    .then(console.log);