Node.js library for the ZBD API
Documentation · Developer Dashboard · Dev Playground · API Status
This is the SDK for NodeJS that interacts with the ZBD API.
ZBD is the payments platform for modern developers, providing the speed and reliability innovators need to create monetized and meaningfully-engaging user experiences.
We enable businesses and consumers to quickly introduce instantaneous Bitcoin payments to the fabric of their applications, games, and platforms. ZBD has the most comprehensive set of Bitcoin Lightning API capabilities and is industry-leader in supporting companies in the fields of gaming, social, adtech and fintech.
With ZBD, it's easy! Anyone can do it. What are YOU building?
If you're an npm
user:
npm install @zbd/node
Or if you're a Yarn
user:
npm install @zbd/node
Below you can find source code examples of how to use each of the available API methods in the @zbd/node SDK library.
// Construct payload
const payload = {
amount: '15000',
expiresIn: 300,
internalId: '1b8h1-h1675',
description: 'Charge description',
callbackUrl: 'https://your-domain.com/zbd-callback'
}
// Create Charge / Payment Request
const data = await zbd.createCharge(payload);
// Get Charge Details
const data = await zbd.getCharge('1907b0fe-789b-4e27-b18a-0c3c0f5cced7');
// Construct payload
const payload = {
invoice: 'lnbc2123250n1pjpr2qmpp526234tljpx5756pa2fyj2zrdmn2tnz9rhj54km2s7dv0pap3vtkqhp5extcuyp2x0ydfwnfhrc5cwx8azxeen2g7hxr29464ezvn3k6w2fqcqzpgxqzjcsp5xzelh2w3twt4ysvva2ugu2klurmrl7nk8h46x2hcthf9cvee24jq9qyyssq6an9tjftjymjeklerjmw8cv4ccpsvd2vzuzxn5upt9s37hnw2r0z0n5cd8cqq8jq5ems00tugt5jnw5jn03tr84945nd6j4hsfsu7kqp9hptk2'
}
// Decode Charge
const data = await zbd.decodeCharge(payload);
// Construct payload
const payload = {
maxAmount: '20000',
minAmount: '10000',
internalId: '1b8h1-h1675',
description: 'Static Charge API Ref',
callbackUrl: 'https://your-domain.com/zbd-callback',
successMessage: 'Congratulations your payment was successful!'
}
// Create Static Charge QR
const data = await zbd.createStaticCharge(payload);
// Get Static Charge Details
const data = await zbd.getCharge('6557a0fe-7a9b-4e27-b18a-0c3c0f5cced7');
// Construct update payload
const updatePayload = {
maxAmount: '5000000',
minAmount: '10000',
...
}
// Update Static Charge Details
const data = await zbd.updateStaticCharge(
'6557a0fe-7a9b-4e27-b18a-0c3c0f5cced7',
updatePayload,
);
// Construct payload
const payload = {
amount: '15000',
description: 'Withdraw QR!',
expiresIn: 300,
internalId: '1b8h1-h1675',
callbackUrl: 'https://your-domain.com/zbd-callback'
}
// Create Withdrawal Request
const data = await zbd.createWithdrawalRequest(payload);
// Get Withdrawal Request Details
const data = await zbd.getWithdrawalRequest('6557a0fe-7a9b-4e27-b18a-0c3c0f5cced7');
// Construct payload
const payload = {
amount: '15000',
lnAddress: '[email protected]',
comment: 'Lightning fast!',
internalId: '1b8h1-h1675',
callbackUrl: 'https://your-domain.com/zbd-callback'
}
// Sending Lightning Address Payment
const data = await zbd.sendLightningAddressPayment(payload);
// Validate Lightning Address
const data = await zbd.validateLightningAddress('[email protected]');
// Construct payload
const payload = {
amount: '15000',
lnAddress: '[email protected]',
description: 'Lightning fast!',
}
// Create Charge / Payment Request for given ZBD Gamertag
const data = await zbd.createChargeFromLightningAddress(payload);
// Get Wallet Balance
const data = await zbd.getWallet();
// Construct payload
const payload = {
amount: '10000',
receiverWalletId: 'b994ee02-dc0b-4f14-b99f-1f2d3daa01a6'
}
// Initiate Internal Transfer
const data = await zbd.internalTransfer(payload);
// Construct payload
const payload = {
amount: '10000',
callbackUrl: 'https://your-domain.com/zbd-callback',
pubkey: '0332d57355d673e217238ce3e4be8491aa6b2a13f95494133ee243e57df1653ace',
}
// Sending Keysend Payment
const data = await zbd.sendKeysendPayment(payload);
// Construct payload
const payload = {
description: 'Lightning fast!',
invoice: 'lnbc2123250n1pjpr2qmpp526234tljpx5756pa2fyj2zrdmn2tnz9rhj54km2s7dv0pap3vtkqhp5extcuyp2x0ydfwnfhrc5cwx8azxeen2g7hxr29464ezvn3k6w2fqcqzpgxqzjcsp5xzelh2w3twt4ysvva2ugu2klurmrl7nk8h46x2hcthf9cvee24jq9qyyssq6an9tjftjymjeklerjmw8cv4ccpsvd2vzuzxn5upt9s37hnw2r0z0n5cd8cqq8jq5ems00tugt5jnw5jn03tr84945nd6j4hsfsu7kqp9hptk2',
internalId: '1b8h1-h1675',
callbackUrl: 'https://your-domain.com/zbd-callback'
}
// Make Payment
const data = await zbd.sendPayment(payload);
// Get Payment Transaction Details
const data = await zbd.getPayment('6557a0fe-7a9b-4e27-b18a-0c3c0f5cced7');
// Construct payload
const payload = {
amount: '10000',
gamertag: 'andre',
description: 'Sending to ZBD Gamertag',
}
// Sending ZBD Gamertag Payment
const data = await zbd.sendGamertagPayment(payload);
// Get Gamertag Payment Transaction Details
const data = await zbd.getGamertagTransaction('6557a0fe-7a9b-4e27-b18a-0c3c0f5cced7');
// Get User ID
const data = await zbd.getUserIdByGamertag('satoshi');
// Get User ID
const data = await zbd.getGamertagByUserId('6557a0fe-7a9b-4e27-b18a-0c3c0f5cced7');
// Is Supported Region
const data = await zbd.isSupportedRegion('12.110.139.14');
// Get ZBD API Production IPs
const data = await zbd.getZBDProdIps();
// Get BTC USD Exchange Rate
const data = await zbd.getBtcUsdExchangeRate();
View full documentation and API reference for the @zbd/node library.
Reminder that while you should use the @zbd/node library if you're in a Node.js environment, you can also work with the HTTP API directly. Full API reference and details can be found here.
Join our Discord