ZEBEDEE NodeJS SDK
ZEBEDEE NodeJS SDK to integrate Bitcoin Lightning microtransactions into your game server or application server with ease.
Documentation
For detailed information about the endpoints available in the ZEBEDEE platform please refer to our Documentation Website.
Installation
zebedee-nodejs
is a JavaScript library that facilitates the interaction with the ZEBEDEE API in NodeJS projects.
To install it run:
npm install zebedee-nodejs --save
or
yarn add zebedee-nodejs
API Initialization
import { initAPI } from 'zebedee-node';
const apiOptions = { apiKey: 'XXXXXX' };
initAPI(apiOptions);
Creating Charge
import { createCharge } from 'zebedee-nodejs';
const payload = {
expiresIn: 300,
amount: "50000",
description: 'My Custom Charde Description',
callbackUrl: 'https://yourapp.com/callback',
internalId: '11af01d092444a317cb33faa6b8304b8',
};
try {
const response = await createCharge(payload);
} catch(error) {
console.log({ error });
}
Get Charge Details
import { getChargeDetails } from 'zebedee-nodejs';
const chargeId = 'c8be70f8-6722-4bac-bfaa-504a24ac7082';
try {
const response = await getChargeDetails(chargeId);
} catch(error) {
console.log({ error });
}
Creating Withdrawal Request
import { createWithdrawalRequest } from 'zebedee-nodejs';
const payload = {
expiresIn: 300,
amount: "50000",
internalId: '11af01d092444a317cb33faa6b8304b8',
description: 'My Custom Withdrawal Description',
callbackUrl: 'https://yourapp.com/callback',
};
try {
const response = await createWithdrawalRequest(payload);
} catch(error) {
console.log({ error });
}
Making Payment
import { makePayment } from 'zebedee-nodejs';
const payload = {
invoice: 'lnbc10.....',
description: 'My New Description',
internalId: '11af01d092444a317cb33faa6b8304b8',
};
try {
const response = await makePayment(payload);
console.log({ response });
} catch(error) {
console.log({ error });
}
Webhooks
Use the callbackUrl
properties in the Charge
and WithdrawalRequest
payloads to receive webhook calls. These webhooks are invoked when your Charge/WithdrawalRequest succeeds, fails, or when it eventually expires.
Webhooks give you more access to these entities' lifecycle.
Contributions
ZEBEDEE is a big proponent of Open Source Software. We welcome PRs and contributions to the SDK and will try to review issues and PRs as soon as we can.