This is a C# client for BTCPayServer. Taken from official repository and bundled into Nuget package.
[WIP] Not yet ready!
MIT
- installation via NuGet (BTCPayServer.Client)
- targeting .NET Standard 2.0 (.NET Core, Linux/MacOS compatible)
- Server side:
// create an invoice
var client = new BTCPayServerClientLegacy(new Uri("https://btcpay.yourserver.com"), "legacy_api_key");
var invoice = await client.CreateInvoice(new InvoiceRequestLegacy()
{
Currency = "USD",
Price = 100m,
ItemDesc = "Payment for my_store_order",
OrderId = "my_store_order::xxxyyy",
NotificationUrl = new Uri("https://webhook.site/03b96bf0-dbd3-4da0-b3d1-54aa5e7f794c"),
RedirectUrl = new Uri("https://webhook.site/03b96bf0-dbd3-4da0-b3d1-54aa5e7f794c")
});
// getting an invoice by id
// you have to also specify a token (don't really know why :( )
var invoiceId = invoice.Id;
var invoiceToken = invoice.Token;
var existingInvoice = await client.GetInvoice(invoiceId, invoiceToken);
- Client side:
// display a checkout modal with created invoice id from the previous step
<script src ="https://your.btcpay.url/modal/btcpay.js"></script>
window.btcpay.showInvoice(invoiceId);
// event listeners
window.btcpay.onModalWillEnter(yourCallbackFunction);
window.btcpay.onModalWillLeave(yourCallbackFunction);
- Not implemented on BTCPay Server yet
More usage examples:
- console sample (link)
Pull Requests are welcome!
I do consulting, please don't hesitate to contact me if you have a custom solution you would like me to implement (web, m@mkotas.cz)
Donations gratefully accepted.