Getting Started
The Go Package for ZBD API is available under go-sdk
.
All you have to do to get started is add go-sdk
as a dependency to your Go-based project. You can do so using go install
:
go install github.com/zebedeeio/go-sdk@latest
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 go-sdk
package. You can find your Project API Key in the ZBD Developer Dashboard.
First you must import the go-sdk
package 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).
package main
import zebedee "github.com/zebedeeio/go-sdk"
func main () {
zbd := zebedee.New(YOUR_API_KEY_HERE)
wallet, _ := zbd.wallet()
fmt.Printf("your balance is %s %s
", wallet.Balance, wallet.Unit)
}
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 go-sdk
package.
go-sdk
The goal of the project is to create a beautiful and extensible experience for developers using ZBD APIs in a Go 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 go-sdk
crate. These methods are ONLY available to the zebedee
client instance after it's been properly authenticated with a Project's API Key.
Method | Entity | Description | |||||||||||||||||||
Charge | Charge | Creates a new Charge / Payment Request in the Bitcoin Lightning Network, payable by any Bitcoin Lightning wallet. Struct:
Parameters:
Resources:
| |||||||||||||||||||
DecodeCharge | Charge | Decodes a specific Charge / Payment Request / Invoice from the Bitcoin Lightning Network. This API returns all of the individual properties for the Charge, including the amount, description, expiration, and more. Struct:
Parameters:
Resources:
| |||||||||||||||||||
GetCharge | Charge | Retrieves all information relating to a specific Charge / Payment Request. Parameters:
Resources:
| |||||||||||||||||||
CreateStaticCharge | Static Charge | Static Charges are static Payment Requests in the Bitcoin Lightning Network. Whereas Charges create fixed-amount and single-use Payment Requests that expire, Static Charges provide you a lot more flexibility & capabilities, including variable amounts, multi-use, success messages, and slots. Struct:
Parameters:
Resources:
| |||||||||||||||||||
GetStaticCharge | Static Charge | Retrieves all information relating to a specific Static Charge. Parameters:
Resources:
| |||||||||||||||||||
UpdateStaticCharge | Static Charge | Perform updates to any of the allowed properties of a Static Charge. Struct:
Parameters:
Resources:
| |||||||||||||||||||
WithdrawalRequest | Withdrawal Request | A Withdrawal Request is a QR code that allows someone to scan and receive Bitcoin (e.g. Withdrawals). Struct:
Parameters:
Resources:
| |||||||||||||||||||
GetWithdrawalRequest | Withdrawal Request | Retrieves details about a specific Withdrawal Request. Parameters:
Resources:
| |||||||||||||||||||
SendLightningAddressPayment | Lightning Address | Send Bitcoin payments directly to a Lightning Address. A Lightning Address is an internet identifier (akin to an email address -- [email protected]) that anyone can send Bitcoin Lightning Network payments to. Struct:
Parameters:
Resources:
| |||||||||||||||||||
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:
Resources:
| |||||||||||||||||||
CreateChargeForLightningAddress | 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. Struct:
Parameters:
Resources:
| |||||||||||||||||||
Wallet | Wallet | Retrieves the total balance of a given Project Wallet. Resources:
| |||||||||||||||||||
InternalTransfer | Wallet | Initiates a transfer of funds between two Project Wallets you own. Struct:
Parameters:
Resources:
| |||||||||||||||||||
SendKeysendPayment | Keysend | This endpoint exposes the ability to make payment directly to a Lightning Network node Public Key, without the need for a Payment Request / Charge. Struct:
Parameters:
Resources:
| |||||||||||||||||||
Pay | Payment | Pays a Charge / Payment Request in the Bitcoin Lightning Network. Struct:
Parameters:
Resources:
| |||||||||||||||||||
GetPayment | Payment | Retrieves all the information related to a specific Payment. Parameters:
Resources:
| |||||||||||||||||||
SendGamertagPayment | ZBD Gamertag | This API endpoint is used to send Bitcoin payments directly to a user's ZBD Gamertag. Parameters:
Resources:
| |||||||||||||||||||
FetchGamerTagTransaction | ZBD Gamertag | Get a given ZBD Gamertag when provided with a ZBD User's ID. Parameters:
Resources:
| |||||||||||||||||||
FetchUserIDFromGamertag | ZBD Gamertag | Get a given ZBD User's ID when provided with a ZBD Gamertag. Parameters:
Resources:
| |||||||||||||||||||
FetchGamertagFromUserID | ZBD Gamertag | Invoked when the app first loads. If a plugin reloads, it's invoked again with the existing app. Parameters:
Resources:
| |||||||||||||||||||
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:
Resources:
| |||||||||||||||||||
GetZBDProdIps | 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:
| |||||||||||||||||||
GetBTCUSDExchangeRate | 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:
|
Community Support
Feature Request? Bugfix? Recommendations? We're all ears! Head on over to the go-sdk Issues page and submit one. We also welcome Pull Requests and other contributions to the library.