Skip to main content
Danipa

Invoices

Generate professional invoices, send them to customers, and track payment status automatically.

Overview

The Invoices API lets you create, send, and track invoices programmatically. Each invoice generates a payment link that customers can use to pay. When a customer pays, the invoice status updates automatically and you receive a webhook notification.

Create an Invoice

curl -X POST https://api.danipa.com/ms/v1/merchants/me/invoices \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customerName": "Jane Customer",
    "customerEmail": "jane@customer.com",
    "customerPhone": "+233200000000",
    "lineItems": [
      { "description": "Widget A", "quantity": 2, "unitPrice": 10.00 },
      { "description": "Widget B", "quantity": 1, "unitPrice": 15.00 }
    ],
    "currency": "GHS",
    "dueDate": "2026-04-01",
    "notes": "Thank you for your business!"
  }'

Response:

{
  "id": "inv-1",
  "invoiceNumber": "INV-0001",
  "customerName": "Jane Customer",
  "customerEmail": "jane@customer.com",
  "lineItems": [
    { "description": "Widget A", "quantity": 2, "unitPrice": 10.00, "lineTotal": 20.00 },
    { "description": "Widget B", "quantity": 1, "unitPrice": 15.00, "lineTotal": 15.00 }
  ],
  "subtotal": 35.00,
  "taxAmount": 0,
  "total": 35.00,
  "currency": "GHS",
  "status": "DRAFT",
  "dueDate": "2026-04-01",
  "paymentLinkUrl": "https://pay.danipa.com/inv001",
  "createdAt": "2026-03-13T10:00:00Z"
}

Invoice Lifecycle

DRAFT → SENT → PAID
                ↘ OVERDUE
DRAFT → CANCELLED
StatusDescription
DRAFTInvoice created but not yet sent
SENTInvoice emailed to customer
PAIDCustomer paid via the payment link
OVERDUEPast the due date, still unpaid
CANCELLEDInvoice cancelled by merchant

Send an Invoice

After creating a draft invoice, send it to the customer:

curl -X POST https://api.danipa.com/ms/v1/merchants/me/invoices/inv-1/send \
  -H "Authorization: Bearer YOUR_API_KEY"

This emails the invoice to the customer at the address specified during creation, including a link to the hosted payment page.

List and Filter Invoices

# All invoices
curl https://api.danipa.com/ms/v1/merchants/me/invoices?page=0&size=20 \
  -H "Authorization: Bearer YOUR_API_KEY"

# Filter by status
curl https://api.danipa.com/ms/v1/merchants/me/invoices?status=OVERDUE \
  -H "Authorization: Bearer YOUR_API_KEY"

Webhook Events

EventDescription
invoice.createdNew invoice created
invoice.sentInvoice sent to customer
invoice.paidCustomer paid the invoice
invoice.overdueInvoice is past due date
invoice.cancelledInvoice cancelled

SDK Examples

Java

Invoice invoice = danipa.invoices().create(
    CreateInvoiceRequest.builder()
        .customerName("Jane Customer")
        .customerEmail("jane@customer.com")
        .lineItems(List.of(
            LineItem.of("Widget A", 2, new BigDecimal("10.00")),
            LineItem.of("Widget B", 1, new BigDecimal("15.00"))
        ))
        .currency("GHS")
        .dueDate(LocalDate.of(2026, 4, 1))
        .build()
);

// Send to customer
danipa.invoices().send(invoice.getId());

Node.js

const invoice = await danipa.invoices.create({
  customerName: 'Jane Customer',
  customerEmail: 'jane@customer.com',
  lineItems: [
    { description: 'Widget A', quantity: 2, unitPrice: 10.00 },
    { description: 'Widget B', quantity: 1, unitPrice: 15.00 },
  ],
  currency: 'GHS',
  dueDate: '2026-04-01',
});

await danipa.invoices.send(invoice.id);

PHP

$invoice = $danipa->invoices->create([
    'customerName' => 'Jane Customer',
    'customerEmail' => 'jane@customer.com',
    'lineItems' => [
        ['description' => 'Widget A', 'quantity' => 2, 'unitPrice' => 10.00],
        ['description' => 'Widget B', 'quantity' => 1, 'unitPrice' => 15.00],
    ],
    'currency' => 'GHS',
    'dueDate' => '2026-04-01',
]);

$danipa->invoices->send($invoice->id);

Best Practices

  • Include line items — Itemized invoices are clearer for customers and better for your records
  • Set realistic due dates — Overdue reminders are sent automatically
  • Use webhooks to sync invoice status with your accounting system
  • Include notes for payment terms, thank-you messages, or special instructions