https://github.com/marfusios/btcpayserver-client
C# client for BTCPayServer
https://github.com/marfusios/btcpayserver-client
bitcoin btcpay btcpay-client btcpayserver client cryptocurrency
Last synced: about 1 month ago
JSON representation
C# client for BTCPayServer
- Host: GitHub
- URL: https://github.com/marfusios/btcpayserver-client
- Owner: Marfusios
- License: mit
- Created: 2020-04-25T20:51:59.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T10:15:57.000Z (over 3 years ago)
- Last Synced: 2025-02-23T02:33:22.651Z (over 1 year ago)
- Topics: bitcoin, btcpay, btcpay-client, btcpayserver, client, cryptocurrency
- Language: C#
- Homepage:
- Size: 113 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# BTCPay Server client [](https://travis-ci.com/Marfusios/btcpayserver-client) [](https://www.nuget.org/packages/BTCPayServer.Client) [](https://www.nuget.org/packages/BTCPayServer.Client)
This is a C# client for BTCPayServer. Taken from [official repository](https://github.com/btcpayserver/btcpayserver/tree/master/BTCPayServer.Client) and bundled into Nuget package.
*[WIP] Not yet ready!*
[Releases and breaking changes](https://github.com/Marfusios/btcpayserver-client/releases)
### License:
MIT
### Features
* installation via NuGet ([BTCPayServer.Client](https://www.nuget.org/packages/BTCPayServer.Client))
* targeting .NET Standard 2.0 (.NET Core, Linux/MacOS compatible)
### Usage (legacy API)
* **Server side:**
```csharp
// 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:**
```html
// display a checkout modal with created invoice id from the previous step
window.btcpay.showInvoice(invoiceId);
// event listeners
window.btcpay.onModalWillEnter(yourCallbackFunction);
window.btcpay.onModalWillLeave(yourCallbackFunction);
```
### Usage (new API)
* *Not implemented on BTCPay Server yet*
More usage examples:
* console sample ([link](test_integration/BTCPayServer.Client.Sample/Program.cs))
**Pull Requests are welcome!**
---
### Available for help
I do consulting, please don't hesitate to contact me if you have a custom solution you would like me to implement ([web](http://mkotas.cz/),
)
Donations gratefully accepted.
* [](https://en.cryptobadges.io/donate/1HfxKZhvm68qK3gE8bJAdDBWkcZ2AFs9pw)
* [](https://en.cryptobadges.io/donate/LftdENE8DTbLpV6RZLKLdzYzVU82E6dz4W)
* [](https://en.cryptobadges.io/donate/0xb9637c56b307f24372cdcebd208c0679d4e48a47)