Notification URL / responses
See original GitHub issueFor the invoices you can provide the common Redirect Url but also a Notification Url. The latter is used for updates on payment status (partial payment? expired?; at least thats what I assume).
Sidenote: This way you can also get the payment notification if the user pays but does not hit the redirect url after successful payment or something else breaks on that route.
Logging the response form BTCPay a few interesting things show:
1) notification response: orderId vs posData
- the notification response (from BTCPay) does not include the
orderId
butposData
field. Because Order Id missing you can’t easily load it but you may need some more complicated logic to load your internal order by the BTCPay invoice ID (which is most likely not that straight forward)
Response:
{
"id": "NBBMjdueu3hrd9bDCmbDH2",
"url": null,
"posData": "32",
"status": "complete",
"btcPrice": null,
"price": 0.58,
"currency": "USD",
"invoiceTime": 1529272228000,
"expirationTime": 1529273128000,
"currentTime": 1529272277186,
"btcPaid": null,
"btcDue": null,
"rate": 0.0,
"exceptionStatus": false,
"buyerFields": {
"buyerEmail": "xxxx",
"transactionCurrency": null,
"paymentSubtotals": @ "BTC_LightningLike": 8930,
"paymentTotals": @ "BTC_LightningLike": 8930,
"amountPaid": "0.00000000",
"exchangeRates": @ "BTC": {
"USD": 0.0
}
}
}
- in the BTCPay UI you have the order ID shown but not the
posData
To make this more consistent and assuming that BTCPay already returns the same notification data as the original BitPay API I would suggest to:
- show “posData” also in UI
- BitPay docs suggest that you may also use structured data like JSON in this field too, see https://bitpay.com/docs/create-invoice
2) Notification responses verbose
Makes sense that the server notifies on every status change but this does not look right to me. On payment I get 6 times the same response with payment completed. Seems the server keeps sending notification those last payments (not sure if intended or not?) The actual last payment was around 23:30 but now 00:20 server still sends old completed payment notifications, each 3 times:
Issue Analytics
- State:
- Created 5 years ago
- Comments:21 (21 by maintainers)
Top GitHub Comments
Cool, thank you.
I just did a normal BTC payment and compared the notification. There the payment status is as expected “paid” for the first notification, followed by “confirmed” after first confirmation. (without waiting I guess after 6 confs it will be “complete”). 👍
Another small difference/nitpick: the BTC payment provides the
url
of invoice, the LN payment does not.1477630c78dc4dcced40db3ea38c80fa50630b6a