Invoices
Bill once, collect exactly
GenesisPay invoices are one-off commercial billing documents. They reuse saved customers, support manual tax and discount rates, render as a hosted page and PDF, and collect through the canonical GenesisPay payment flow.
Create and send an invoice
import { GenesisPay } from "@genesis-tech/genesispay-seller";
const genesispay = new GenesisPay({
apiKey: process.env.GENESISPAY_SELLER_KEY!,
});
const customer = await genesispay.customers.create({
name: "Ada Lovelace",
email: "ada@example.com",
companyName: "Analytical Engines Ltd",
countryCode: "GB",
});
const draft = await genesispay.invoices.create({
customerId: customer.publicId,
asset: "EURC",
dueAt: "2026-08-31T23:59:59.999Z",
discountBps: 500,
taxBps: 2300,
lineItems: [
{ description: "Consulting", quantity: 2, unitAmount: "450.00" },
],
});
const invoice = await genesispay.invoices.finalize(draft.publicId);
await genesispay.invoices.send(invoice.publicId, {
idempotencyKey: `initial-${invoice.publicId}`,
});unitAmount is a decimal string in the invoice's asset. Every response total ending in Minor is an integer string, so no float crosses the money boundary.
Lifecycle and payment truth
draft → open → paid
↘ void
↘ uncollectible
open becomes past_due after dueAt; it remains payable.
paid is derived only from a confirmed, non-simulated payment.Drafts are editable, but they have no number, hosted URL, PDF, or payment link. Finalization is the commit point: it assigns the invoice number, snapshots seller/customer/line details, and creates exactly one single-use payment link. Finalized invoices cannot be edited.
Neither the dashboard nor the API can set paid. It is a read-only projection of GenesisPay's verified settlement record, excluding simulated test payments. A confirmed payment wins a race with void or write-off so moved money is never hidden.
Tax and accounting scope
Tax and discount rates are manual basis points: 2300 means 23%. GenesisPay calculates and freezes the arithmetic, but it does not determine tax jurisdiction, issue government-certified fiscal documents, file returns, or provide tax advice. Set the seller's legal details in dashboard settings before finalizing.
Email delivery
invoices.send sends the hosted invoice link and attaches the PDF through the deployment's configured Resend account. Supply a stable idempotencyKey for each intended send; retries with the same key return the same delivery instead of sending another email. Configure RESEND_KEY and a verified RESEND_FROM_EMAIL sender in production.
Choose the right billing primitive
Use invoices for a specific customer and amount. Use a payment link for lightweight checkout, or subscription plans for recurring charges authorized by a payer mandate.