ZBD Logo

C# SDK for ZBD API

// Create API Handler with YOUR API Key passed to the constructor as a string var handler = new ZebedeeHandler(API_KEY); // Make API to Get Wallet Details var wallet = await handler.GetWalletDetails(); // Pay a lightning address var lnPayment = await handler.SendPaymentToLightningAddress("beaver@zbd.gg", "10000", "test comment"); // Make Sure API Call was Successful if (lnPayment.success) { System.Console.WriteLine(lnPayment.id); }

Getting Started

The C# SDK for ZBD API is available under zbd-csharp. When building tools with ZBD support we encourage you to include zbd in the keywords field in .csproj.

All you have to do to get started is add zbd-csharp as a dependency to your C#-based project. You can do so using dotnet:

dotnet add package dev.zbd.csharp

Now let's authenticate a specific Wallet with that ZBD Project's API Key.

Authentication

In order to authenticate your Project Wallet with the ZBD API, you will need to provide your ZBD Project's API Key to the C# SDK. You can find your Project API Key in the ZBD Developer Dashboard.

First you must import the C# SDK client into your codebase, and then instantiate it with your Project API Key (replace `YOUR_API_KEY_HERE` below with your actual ZBD Project's API Key).

var handler = new ZebedeeHandler("YOUR_API_KEY_HERE"); var wallet = await hander.GetWalletDetails(); if(wallet.success) { System.Console.WriteLine(wallet.data.balance); }

You're all set. Now let's move some money at the speed of the internet! Check the SDK API Reference below for more information on how to use the zbd-csharp SDK.

zbd-csharp

The goal of the project is to create a beautiful and extensible experience for developers using ZBD APIs in a dotnet environment. The focus is to provide parity with ZBD REST API, as well as providing further stability for developers.

API Reference

Below is a comprehensive list of the methods and functions available in the zbd-csharp SDK. These methods are ONLY available to the ZebedeeHandler client instance after it's been properly authenticated with a Project's API Key.

MethodEntityDescription
CreateCharge
Charge

Creates a new Charge / Payment Request in the Bitcoin Lightning Network, payable by any Bitcoin Lightning wallet.

Parameters:

expiresInTime until charge expiration -> in seconds.
amount

required

The amount for the Charge -> in millisatoshis.
description

required

Note or comment for this Charge (visible to payer).
internalIDOpen metadata string property.
callbackUrlThe endpoint ZBD will POST Charge updates to.


Resources:

View response payload examples
GetChargeDetails
Charge

Retrieves all information relating to a specific Charge / Payment Request.

Parameters:

chargeID

required

A String representing the ID of the Charge.


Resources:

View response payload examples
CreateWithdrawalRequest
Withdrawal Request

A Withdrawal Request is a QR code that allows someone to scan and receive Bitcoin (e.g. Withdrawals).

Parameters:

expiresInTime until Withdrawal Request expires -> in seconds.
amount

required

The amount for the Withdrawal Request -> in millisatoshis.
descriptionNote or comment for this Withdrawal Request (visible to payer).
internalIDOpen metadata string property.
callbackUrl

required

The endpoint ZBD will POST Withdrawal Request updates to.


Resources:

View response payload examples
GetWithdrawalRequestDetails
Withdrawal Request

Retrieves details about a specific Withdrawal Request.

Parameters:

withdrawalID

required

A String representing the ID of the Withdrawal Request.


Resources:

View response payload examples
SendPaymentToLightningAddress
Lightning Address

Send Bitcoin payments directly to a Lightning Address. A Lightning Address is an internet identifier (akin to an email address -- andre@zbd.gg) that anyone can send Bitcoin Lightning Network payments to.

Parameters:

lnAddress

required

The Lightning Address of the intended recipient.
amount

required

The amount for the Payment -> in millisatoshis.
commentNote or description of this Payment.


Resources:

View response payload examples
ValidateLightningAddress
Lightning Address

Not all internet identifiers are Lightning Addresses / compatible with the Lightning Address protocol. Use this endpoint in order to validate whether a user's entered Lightning Address is valid.

Parameters:

lnAddress

required

The lightning address to be validated.


Resources:

View response payload examples
FetchChargeFromLightningAddress
Lightning Address

Generates a Bitcoin Lightning Charge / Payment Request for a given Lightning Address destination. Depending on your system's configuration or your product's UX, you may need the ability to generate Charges for specific users using a different provider than ZBD.

Parameters:

lnaddress

required

The Lightning Address of the intended recipient.
amount

required

The amount for the Charge -> in millisatoshis.
commentNote or comment of this Charge.


Resources:

View response payload examples
GetWalletDetails
Wallet

Retrieves the total balance of a given Project Wallet.



Resources:

View response payload examples
InitiateInternalTransfer
Wallet

Initiates a transfer of funds between two Project Wallets you own.

Parameters:

amount

required

The amount to be transferred -> in millisatoshis.
receiverWalletId

required

The Wallet ID of the recipient Project.


Resources:

View response payload examples
PayInvoice
Payment

Pays a Charge / Payment Request in the Bitcoin Lightning Network.

Parameters:

descriptionNote or comment for this Payment.
internalIdOpen metadata string property.
invoice

required

Lightning Network Payment Request/Charge.
amountThe amount to be paid -> in millisatoshis.
callbackUrlThe endpoint ZBD will POST Charge updates to.


Resources:

View response payload examples
GetPaymentDetails
Payment

Retrieves all the information related to a specific Payment.

Parameters:

paymentID

required

A String representing the ID of the Payment.


Resources:

View response payload examples
SendPaymentToGamertag
ZBD Gamertag

This API endpoint is used to send Bitcoin payments directly to a user's ZBD Gamertag.

Parameters:

gamertag

required

Desination ZBD gamertag.
amount

required

The amount for the Payment -> in millisatoshis.
descriptionNote or comment for this Payment (visible to recipient).


Resources:

View response payload examples
FetchGamertagTransactionDetailsByID
ZBD Gamertag

Get a given ZBD Gamertag when provided with a ZBD User's ID.

Parameters:

transactionID

required

A String representing the ZBD Gamertag Payment Transaction ID.


Resources:

View response payload examples
FetchUserIDByGamertag
ZBD Gamertag

Get a given ZBD User's ID when provided with a ZBD Gamertag.

Parameters:

gamertag

required

A String representing the ZBD Gamertag of the ZBD user.


Resources:

View response payload examples
FetchGamertagByUserID
ZBD Gamertag

Invoked when the app first loads. If a plugin reloads, it's invoked again with the existing app.

Parameters:

userID

required

A String representing the specified ZBD User ID.


Resources:

View response payload examples
IsSupportedRegion
Utility

If you wish to know whether the incoming user request is coming from a region/country where ZBD is supported or not, you can use this simple API endpoint and pass the target IP address as a parameter.

Parameters:

ip

required

A String representing the IP Address being checked.


Resources:

View response payload examples
APIProductionIPs
Utility

The ZBD API relies on callback URLs for keeping you informed about updates that occur to any Charges, Payments, or Withdrawals you've created. In order to ensure that any incoming callback message is indeed from a trusted ZBD API infrastructure server, we provide this API endpoint for you to know which IP addresses real requests come from.



Resources:

View response payload examples
BTCUSDExchangeRate
Utility

Get the latest price for Bitcoin in US Dollars. The exchange rate feed is refreshed every 5 seconds and is based upon a combination of industry-leading partner exchange providers's price feeds.



Resources:

View response payload examples

Community Support

Feature Request? Bugfix? Recommendations? We're all ears! Head on over to the zbd-csharp Issues page and submit one. We also welcome Pull Requests and other contributions to the library.