Guides
Invoices & Payments
Manage invoices and process payments through multiple providers.
Invoices & Payments
NovaBilling automatically generates invoices for subscriptions and processes payments through your configured providers.
Invoice Lifecycle
DRAFT → FINALIZED → PAID
→ FAILED → PAID (after retry)
→ VOID
List Invoices
curl "http://localhost:3000/api/invoices?status=PENDING&page=1&limit=20" \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
import { NovaBillingClient } from 'novabilling';
const client = new NovaBillingClient({ token: 'sk_live_a1b2c3d4...' });
const invoices = await client.invoices.list({
status: 'PENDING',
page: 1,
limit: 20
});
for (const invoice of invoices.data) {
console.log(`${invoice.id}: ${invoice.currency} ${invoice.amount} - ${invoice.status}`);
}
from novabilling import NovaBilling
client = NovaBilling(token="sk_live_a1b2c3d4...")
invoices = client.invoices.list(status="PENDING", page=1, limit=20)
for invoice in invoices.data:
print(f"{invoice.id}: {invoice.currency} {invoice.amount} - {invoice.status}")
Create a Manual Invoice
curl -X POST http://localhost:3000/api/invoices \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk_live_a1b2c3d4..." \
-d '{
"customerId": "cust_x1y2z3",
"dueDate": "2025-02-28",
"items": [
{"description": "Pro Plan - Monthly", "quantity": 1, "unitAmount": 180000}
]
}'
const invoice = await client.invoices.create({
customerId: 'cust_x1y2z3',
dueDate: '2025-02-28',
items: [
{ description: 'Pro Plan - Monthly', quantity: 1, unitAmount: 180000 }
]
});
invoice = client.invoices.create(
customer_id="cust_x1y2z3",
due_date="2025-02-28",
items=[
{"description": "Pro Plan - Monthly", "quantity": 1, "unit_amount": 180000}
]
)
Finalize and Pay
# Finalize a draft invoice
curl -X POST http://localhost:3000/api/invoices/inv_abc123/finalize \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
# Mark as manually paid
curl -X POST http://localhost:3000/api/invoices/inv_abc123/mark-paid \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
# Void an invoice
curl -X POST http://localhost:3000/api/invoices/inv_abc123/void \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
// Finalize a draft invoice
await client.invoices.finalize('inv_abc123');
// Mark as manually paid
await client.invoices.markPaid('inv_abc123');
// Void an invoice
await client.invoices.void('inv_abc123');
client.invoices.finalize("inv_abc123")
client.invoices.mark_paid("inv_abc123")
client.invoices.void("inv_abc123")
Download PDF
curl "http://localhost:3000/api/invoices/inv_abc123/pdf" \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
const pdf = await client.invoices.getPdf('inv_abc123');
console.log(pdf.url); // URL to download the PDF
pdf = client.invoices.get_pdf("inv_abc123")
print(pdf.url)
Checkout
Generate a hosted checkout URL for an invoice so customers can pay online:
curl -X POST http://localhost:3000/api/invoices/inv_abc123/checkout \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk_live_a1b2c3d4..." \
-d '{}'
const checkout = await client.invoices.checkout('inv_abc123');
console.log(checkout.checkoutUrl);
checkout = client.invoices.checkout("inv_abc123")
print(checkout.checkout_url)
Payments
Payments are created automatically when invoices are processed. You can list and refund them.
List Payments
curl "http://localhost:3000/api/payments?page=1&limit=20" \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
const payments = await client.payments.list({
page: 1,
limit: 20
});
payments = client.payments.list(page=1, limit=20)
Refund a Payment
curl -X POST http://localhost:3000/api/payments/pay_abc123/refund \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk_live_a1b2c3d4..." \
-d '{
"amount": 50000,
"reason": "Customer overcharged"
}'
const refund = await client.payments.refund('pay_abc123', {
amount: 50000, // Partial refund in UGX
reason: 'Customer overcharged'
});
refund = client.payments.refund(
"pay_abc123",
amount=50000,
reason="Customer overcharged"
)
Payment Statuses
| Status | Description |
|---|---|
PENDING | Payment initiated but not yet processed |
PROCESSING | Payment is being processed by the provider |
SUCCEEDED | Payment completed successfully |
FAILED | Payment attempt failed |
REFUNDED | Payment has been refunded |