Invoices
Create, manage, and track invoices for customers.
Invoices are generated automatically by subscription renewals or created manually via the API.
Create an Invoice
curl -X POST https://api.tryaccess.xyz/api/v1/invoices \
-H "Content-Type: application/json" \
-H "x-api-key: sk_..." \
-d '{
"customer_id": "cus_01HXYZ...",
"subscription_id": "sub_01HXYZ...",
"amount": 50000,
"currency": "ETB",
"due_date": "2025-12-31T00:00:00.000Z"
}'Response:
{
"id": "inv_01HXYZ...",
"amount": 50000,
"currency": "ETB",
"status": "PENDING",
"issued_at": "2025-01-15T10:00:00.000Z",
"due_date": "2025-12-31T00:00:00.000Z",
"created_at": "2025-01-15T10:00:00.000Z",
"updated_at": "2025-01-15T10:00:00.000Z",
"metadata": null
}Parameters
| Field | Type | Required | Description |
|---|---|---|---|
customer_id | string | Yes | Customer to invoice |
subscription_id | string | No | Subscription this invoice belongs to. Leave it out for a one-off invoice. |
amount | number | Yes | Total amount in minor units (santim). 1 ETB = 100 santim |
currency | string | No | ISO 4217 code (default: ETB) |
due_date | string | Yes | ISO 8601 due date. Must be in the future |
metadata | object | No | Arbitrary key-value pairs |
Invoice IDs are prefixed with inv_.
List Invoices
curl "https://api.tryaccess.xyz/api/v1/invoices?status=PENDING&limit=20" \
-H "x-api-key: sk_..."| Parameter | Description |
|---|---|
cursor | Pagination cursor from the previous response's next_cursor |
limit | Results per page (1–100, default 20) |
status | Filter by status: DRAFT, PENDING, PAID, OVERDUE, VOIDED, CANCELED |
subscription_id | Filter by subscription |
customer_id | Filter by customer |
The response includes an embedded customer object with id, name, email, and phone_number.
Get an Invoice
curl https://api.tryaccess.xyz/api/v1/invoices/inv_01HXYZ... \
-H "x-api-key: sk_..."Returns the invoice with customer details and linked subscription.
Mark as Paid
curl -X POST https://api.tryaccess.xyz/api/v1/invoices/inv_01HXYZ.../pay \
-H "Content-Type: application/json" \
-H "x-api-key: sk_..." \
-d '{}'Response:
{
"id": "inv_01HXYZ...",
"amount": 50000,
"currency": "ETB",
"status": "paid",
"paid_at": "2025-01-15T11:00:00.000Z"
}Cannot mark voided or canceled invoices as paid.
Void an Invoice
curl -X POST https://api.tryaccess.xyz/api/v1/invoices/inv_01HXYZ.../void \
-H "x-api-key: sk_..."Response:
{
"id": "inv_01HXYZ...",
"amount": 50000,
"currency": "ETB",
"status": "voided"
}Paid invoices cannot be voided.
Invoice Lifecycle
DRAFT → PENDING → PAID
PENDING → OVERDUE (past due date)
PENDING → VOIDED
PENDING → CANCELEDWebhook Events
| Event | Description |
|---|---|
invoice.paid | Invoice was marked as paid |
invoice.overdue | Invoice passed its due date |
invoice.voided | Invoice was voided |
Endpoint Summary
| Action | Method | Endpoint |
|---|---|---|
| Create | POST | /api/v1/invoices |
| List | GET | /api/v1/invoices |
| Get | GET | /api/v1/invoices/:id |
| Mark paid | POST | /api/v1/invoices/:id/pay |
| Void | POST | /api/v1/invoices/:id/void |
How is this guide?