ZBD Logo

Go Package for ZBD API

package main import zebedee "github.com/zebedeeio/go-sdk" func main () { zbd := zebedee.New(APIKEY) // pay an invoice payment, _ := zbd.Pay(&zebedee.Payment{ InternalID: "aninternalpaymentid", Description: "a payment I'm making", Invoice: "lnbc...", }) fmt.Printf("payment sent: %s\n", payment.Status) }

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.

MethodEntityDescription
Charge
Charge

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

Struct:

ChargeThe Charge reference containing the required parameters.


Parameters:

Amount

required

The amount for the Charge -> in millisatoshis.
Description

required

Note or comment for this Charge (visible to payer).
ExpiresInTime until charge expiration -> in seconds.
InternalIDOpen metadata string property.
CallbackURLThe endpoint ZBD will POST Charge updates to.


Resources:

View response payload examples
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:

DecodeChargeOptionsTypeThe DecodeChargeOptionsType reference containing the required parameters.


Parameters:

Invoice

required

The code for the Charge / Payment Request / Lightning Network invoice (e.g. lnbc10m.....61hj).


Resources:

View response payload examples
GetCharge
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
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:

StaticChargeOptionsTypeThe StaticChargeOptionsType reference containing the required parameters.


Parameters:

MinAmount

required

Minimum allowed amount for the Static Charge -> in millisatoshis.
MaxAmount

required

Maximum allowed amount for the Static Charge -> in millisatoshis.
Description

required

Note or comment for this Static Charge (visible to payer).
SuccessMessageMessage displayed to the payer AFTER payment settles.
AllowedSlotsNumber of payments this Static Charge can accept
InternalIDOpen metadata string property.
CallbackURLThe endpoint ZBD will POST updates to.


Resources:

View response payload examples
GetStaticCharge
Static Charge

Retrieves all information relating to a specific Static Charge.

Parameters:

staticChargeID

required

The ID of the Static Charge.


Resources:

View response payload examples
UpdateStaticCharge
Static Charge

Perform updates to any of the allowed properties of a Static Charge.

Struct:

StaticChargeOptionsTypeThe StaticChargeOptionsType reference containing the required parameters.


Parameters:

chargeIDThe ID of the Static Charge to update.
MinAmountMinimum allowed amount for the Static Charge -> in millisatoshis.
MaxAmountMaximum allowed amount for the Static Charge -> in millisatoshis.
DescriptionNote or comment for this Static Charge (visible to payer).
SuccessMessageMessage displayed to the payer AFTER payment settles.
AllowedSlotsNumber of payments this Static Charge can accept
InternalIDOpen metadata string property.
CallbackURLThe endpoint ZBD will POST updates to.


Resources:

View response payload examples
WithdrawalRequest
Withdrawal Request

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

Struct:

WithdrawalRequestThe WithdrawalRequest reference containing the required parameters.


Parameters:

Amount

required

The amount for the Withdrawal Request -> in millisatoshis.
ExpiresInTime until Withdrawal Request expires -> in seconds.
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
GetWithdrawalRequest
Withdrawal Request

Retrieves details about a specific Withdrawal Request.

Parameters:

wrequestID

required

A string representing the ID of the Withdrawal Request.


Resources:

View response payload examples
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:

SendLightningAddressPaymentOptionsTypeThe SendLightningAddressPaymentOptionsType reference containing the required parameters.


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:

LightningAddress

required

The string reference containing the address to be validated.


Resources:

View response payload examples
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:

CreateChargeFromLightningAddressOptionsTypeThe CreateChargeFromLightningAddressOptionsType reference containing the lightning address.


Parameters:

LNAddress

required

The Lightning Address of the intended recipient.
Amount

required

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


Resources:

View response payload examples
Wallet
Wallet

Retrieves the total balance of a given Project Wallet.



Resources:

View response payload examples
InternalTransfer
Wallet

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

Struct:

InternalTransferOptionsTypeThe InternalTransferOptionsType reference containing the payload info for the transfer.


Parameters:

Amount

required

The amount to be transferred -> in millisatoshis.
ReceiverWalletId

required

The Wallet ID of the recipient Project.


Resources:

View response payload examples
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:

KeysendOptionsTypeThe KeysendOptionsType reference containing the payload.


Parameters:

Amount

required

The amount for the Payment -> in millisatoshis.
Pubkey

required

The Public Key for the destination Lightning Node.
CallbackURLThe endpoint ZBD will POST updates to.
TLVRecordsTLV data records.


Resources:

View response payload examples
Pay
Payment

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

Struct:

PaymentThe Payment reference containing the payment information.


Parameters:

Invoice

required

Lightning Network Payment Request/Charge.
DescriptionNote or comment for this Payment.
InternalIDOpen metadata string property.


Resources:

View response payload examples
GetPayment
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
SendGamertagPayment
ZBD Gamertag

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

Parameters:

Amount

required

The amount for the Payment -> in millisatoshis.
Gamertag

required

Desination ZBD gamertag.
DescriptionNote or comment for this Payment (visible to recipient).


Resources:

View response payload examples
FetchGamerTagTransaction
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
FetchUserIDFromGamertag
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
FetchGamertagFromUserID
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:

ipAddress

required

A string representing the IP Address being checked.


Resources:

View response payload examples
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:

View response payload examples
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:

View response payload examples

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.