xtopaydocs

Invoices

Bill customers from your own system. Make an invoice, send it by email, remind, void, and hear when it's paid.

Live

Invoices work through the API today, with test and live keys.

An invoice bills one customer for line items, with a discount and taxes if you like, and is paid in full on its page, xtopay.me/i/<reference>. They're the same invoices as the dashboard's Invoices (see the guide). Paying one is an ordinary payment, with source.type invoice.

Test invoices

A test key makes test invoices: numbered on their own (INV-0001 on), paid through the test provider, kept out of the dashboard, and never emailed, not even to the customer. Live ones are emailed when sent.

The invoice object

{
  "id": "ivc_9j3h5k7vbc2d6f8g1rsy",
  "number": "INV-0042",
  "reference": "7K2M9QH4TZ3B",
  "url": "https://xtopay.me/i/7K2M9QH4TZ3B",
  "mode": "live",
  "status": "open",
  "overdue": false,
  "customer": { "name": "Ama Serwaa", "email": "ama@example.com", "phone": null },
  "items": [
    { "description": "Kenkey and fish", "quantity": 4, "unit_price": 25, "amount": 100 }
  ],
  "discount": { "type": "percent", "value": 10 },
  "taxes": [{ "name": "VAT", "rate": 15, "amount": 13.5 }],
  "subtotal": 100,
  "discount_amount": 10,
  "tax_amount": 13.5,
  "total": 103.5,
  "notes": "Thank you!",
  "issue_date": "2026-10-24",
  "due_date": "2026-10-31",
  "auto_remind": true,
  "sent_at": "2026-10-24T09:16:10Z",
  "reminded_at": null,
  "paid_at": null,
  "paid_outside": false,
  "paid_note": null,
  "voided_at": null,
  "payment_reference": null,
  "created_at": "2026-10-24T09:16:10Z"
}
status
draftNot sent yet. Its page doesn't exist
openSent, waiting to be paid. overdue is true once the due date has passed
paidPaid on its page (payment_reference is the payment), or marked paid in the dashboard (paid_outside)
voidCancelled; it can't be paid

Make an invoice

POST/v1/invoices

Prop

Type

curl https://api.xtopay.co/v1/invoices \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": { "name": "Ama Serwaa", "email": "ama@example.com" },
    "items": [{ "description": "Kenkey and fish", "quantity": 4, "unit_price": 25 }],
    "due_date": "2026-10-31",
    "send": true
  }'

Sending answers with the invoice and emailed: whether the customer was emailed (they need an email, and test invoices never are).

Send, remind and void

POST/v1/invoices/{id}/send

Sends a draft (it becomes open), or sends an open one again.

POST/v1/invoices/{id}/remind

Emails the customer a reminder: open invoices with an email, 3 a day at most.

POST/v1/invoices/{id}/void

Cancels a draft or open invoice. A paid one can't be voided.

Change an invoice

PATCH/v1/invoices/{id}

Drafts and open invoices can change: send only what changes. The totals are worked out again.

Get, list and delete invoices

GET/v1/invoices/{id}
GET/v1/invoices

Newest first: status (draft, open, overdue, paid or void), search (a customer's name or email, or a number like INV-0042), page and page_size.

DELETE/v1/invoices/{id}

Only drafts can be deleted; void a sent invoice instead, so there's a record of it.

Hearing it's paid

Paying an invoice is a payment: the payment.successful webhook comes with source.type invoice and the invoice's id in source.id.

On this page