Skip to Content
Getting StartedQuickstart

Quickstart

Get from zero to a submitted invoice in under 5 minutes.

Prerequisites:

  • Node.js 18 or higher
  • An Yona account with an API key (get one at app.useyona.com )

Step 1 — Install the SDK

npm install @useyona/einvoice-js

Step 2 — Initialize the client

import { EInvoice } from '@useyona/einvoice-js'; const client = new EInvoice({ apiKey: 'sk_test_your_key_here' });

The SDK auto-detects your environment from the key prefix. sk_test_* uses the sandbox — no real tax submissions.

Step 3 — Register a seller

A seller is the business issuing the invoice. You need at least one.

const seller = await client.sellers.create({ partyName: 'Acme Nigeria Ltd', email: 'billing@acme.ng', phoneNumber: '+2348012345678', taxNumber: '12345678-0001', postalAddress: { line1: '123 Commerce Street', city: 'Lagos', state: 'Lagos', country: 'NG', }, });

Step 4 — Register a buyer

A buyer is the entity receiving the invoice. taxNumber is optional for B2C.

const buyer = await client.buyers.create({ partyName: 'John Doe Enterprises', email: 'john@example.com', phoneNumber: '+2349087654321', postalAddress: { line1: '456 Market Road', city: 'Abuja', country: 'NG', }, });

Step 5 — Create an invoice

const invoice = await client.invoices.create({ sellerId: seller.data.id, buyerId: buyer.data.id, invoiceNumber: 'INV-2026-001', invoiceDate: '2026-04-19', lineItems: [ { description: 'Consulting services — April 2026', quantity: 10, unitPrice: 50000, taxPercent: 7.5, hsnCode: '9983', unitCode: 'HUR', }, ], });

The response includes the calculated payableAmount and status: 'draft'.

Step 6 — Submit the invoice

const submission = await client.invoices.submit(invoice.data.id);

In sandbox, the mock tax authority will accept this within seconds. In production, this is irreversible.

Step 7 — Check the status

const status = await client.invoices.getStatus(invoice.data.id);

The status field progresses through queuedpendingaccepted. Your first invoice is submitted.

Next steps

Last updated on