Node.js Examples
Native fetch (Node 18+), no dependencies. Full files: examples/nodejs/ in the integration ZIP.
#Minimal client
const BASE = "https://api.boostigo.io";
const KEY = process.env.BOOSTIGO_API_KEY;
async function boostigo(method, path, body) {
const res = await fetch(BASE + path, {
method,
headers: { Authorization: `Bearer ${KEY}`, Accept: "application/json", ...(body ? { "Content-Type": "application/json" } : {}) },
body: body ? JSON.stringify(body) : undefined,
});
const json = await res.json().catch(() => ({ success: false, error: { code: "INTERNAL_ERROR", message: "Invalid response" } }));
return { status: res.status, ...json };
}
#Identify → confirm → recharge
const id = await boostigo("GET", "/likee/user/1137852558");
if (!id.success) throw new Error(`${id.error.code}: ${id.error.message}`);
const user = id.data.user;
console.log(`Recharging ${user.nickname} (${user.likee_uid})`); // confirm with your customer
const order = await boostigo("POST", "/likee/recharge", {
likee_id: user.likee_id,
likee_uid: user.likee_uid,
diamond: 5000,
amount: "95.00",
request_id: "ORDER-CLIENT-10001", // your unique reference
});
if (order.success) console.log(order.data.order_id, order.data.status); // BST-LKE-…, processing
else console.error(order.error.code, order.error.message);
#Order status
const o = await boostigo("GET", "/orders/BST-LKE-8F72A19X");
console.log(o.success ? o.data.status : o.error.code);
#Webhook endpoint (Express)
See Verify Signature — use express.raw() so the raw body is available for HMAC verification, compare with crypto.timingSafeEqual, then respond 200.