Invoices
Learn how to create, manage, and submit invoices to ZIMRA using the VasBox API.
Invoices are the primary document type in VasBox. They represent a request for payment from a customer and can be submitted to ZIMRA for fiscal compliance.
The Invoice Object
The invoice object contains all the information about a transaction, including customer details, line items, taxes, and fiscal status.
{
"id": "inv_abc123",
"number": "INV-2024-0001",
"status": "draft",
"customer_id": "cust_xyz789",
"customer": {
"id": "cust_xyz789",
"name": "Acme Corporation",
"tin": "123456789"
},
"items": [
{
"id": "itm_001",
"description": "Software License",
"quantity": 1,
"unit_price": 5000.00,
"tax_code": "STD",
"tax_amount": 750.00,
"total": 5750.00
}
],
"subtotal": 5000.00,
"tax_total": 750.00,
"total": 5750.00,
"currency": "USD",
"fiscal_code": null,
"zimra_submitted_at": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
Invoice Statuses
| Status | Description |
|---|---|
| draft | Invoice is created but not yet finalized. Can be edited. |
| pending | Invoice is queued for ZIMRA submission. |
| submitted | Successfully submitted to ZIMRA with fiscal code. |
| failed | ZIMRA submission failed. Check error details. |
| cancelled | Invoice has been voided or cancelled. |
Create an Invoice
Create a new invoice with customer and line item details. The invoice will be created in draft status.
/v1/invoicesCreates a new invoice for the specified customer.
Request Body
customer_idstring required The unique identifier of the customer.
Example: cust_xyz789
currencystring default: USDThree-letter ISO currency code.
Example: USD
itemsarray required Array of line items for the invoice.
notesstringOptional notes or memo for the invoice.
Example Request
{
"customer_id": "cust_xyz789",
"currency": "USD",
"items": [
{
"description": "Software License",
"quantity": 1,
"unit_price": 5000.00,
"tax_code": "STD"
}
],
"notes": "Annual license renewal"
}
Response
{
"id": "inv_abc123",
"number": "INV-2024-0001",
"status": "draft",
"customer_id": "cust_xyz789",
"customer": {
"id": "cust_xyz789",
"name": "Acme Corporation",
"tin": "123456789"
},
"items": [
{
"id": "itm_001",
"description": "Software License",
"quantity": 1,
"unit_price": 5000.00,
"tax_code": "STD",
"tax_amount": 750.00,
"total": 5750.00
}
],
"subtotal": 5000.00,
"tax_total": 750.00,
"total": 5750.00,
"currency": "USD",
"fiscal_code": null,
"zimra_submitted_at": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
List Invoices
Retrieve a paginated list of invoices. You can filter by status, customer, and date range.
/v1/invoicesReturns a paginated list of invoices.
Query Parameters
statusstringFilter by invoice status.
Example: submitted
customer_idstringFilter by customer ID.
fromstringStart date for date range filter (ISO 8601).
Example: 2024-01-01
tostringEnd date for date range filter (ISO 8601).
Example: 2024-01-31
pageinteger default: 1Page number for pagination.
per_pageinteger default: 20Number of items per page (max 100).
Response
{
"data": [
{
"id": "inv_abc123",
"number": "INV-2024-0001",
"status": "submitted",
"total": 5750.00,
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": "inv_def456",
"number": "INV-2024-0002",
"status": "draft",
"total": 2500.00,
"created_at": "2024-01-16T14:20:00Z"
}
],
"meta": {
"current_page": 1,
"per_page": 20,
"total": 42,
"last_page": 3
}
}
Retrieve an Invoice
Retrieve the details of a specific invoice by its ID.
/v1/invoices/{invoice_id}Retrieves the details of an existing invoice.
Path Parameters
invoice_idstring required The unique identifier of the invoice.
Example: inv_abc123
Response
{
"id": "inv_abc123",
"number": "INV-2024-0001",
"status": "draft",
"customer_id": "cust_xyz789",
"customer": {
"id": "cust_xyz789",
"name": "Acme Corporation",
"tin": "123456789"
},
"items": [
{
"id": "itm_001",
"description": "Software License",
"quantity": 1,
"unit_price": 5000.00,
"tax_code": "STD",
"tax_amount": 750.00,
"total": 5750.00
}
],
"subtotal": 5000.00,
"tax_total": 750.00,
"total": 5750.00,
"currency": "USD",
"fiscal_code": null,
"zimra_submitted_at": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
{
'error': {
'code': 'invoice_not_found',
'message': 'The requested invoice does not exist.'
}
}
Submit to ZIMRA
Submit an invoice to ZIMRA for fiscal validation and receive a fiscal code. This action is irreversible once successful.
Important
/v1/invoices/{invoice_id}/submitSubmits the invoice to ZIMRA for fiscal validation.
Path Parameters
invoice_idstring required The unique identifier of the invoice to submit.
Example: inv_abc123
Response
{
'id': 'inv_abc123',
'status': 'submitted',
'fiscal_code': 'ZW-2024-ABC123-XYZ',
'zimra_submitted_at': '2024-01-15T10:35:00Z'
}
{
'error': {
'code': 'submission_failed',
'message': 'ZIMRA validation failed.',
'details': [
'Customer TIN is invalid',
'Tax calculation mismatch'
]
}
}