BramaPay Docs

JavaScript / TypeScript

Create an invoice with fetch and decimal strings.

const response = await fetch("https://api.bramapay.com/v1/invoices", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Api-Key": process.env.BRAMAPAY_API_KEY!,
    "Idempotency-Key": "order-1001-attempt-1",
  },
  body: JSON.stringify({
    amount: "25.00",
    asset: "USDT",
    network: "TRON",
    externalId: "ORDER-1001",
  }),
});

if (!response.ok) throw new Error(await response.text());
const invoice = await response.json();

Keep amounts as strings from your database through the API request.