Appearance
User - Invoices
Base URL:
https://your-domain.com
Admin endpoints for managing invoices. All endpoints require admin/staff authentication.
Fetch All Invoices
Retrieve a paginated list of all invoices with optional filters.
| Property | Value |
|---|---|
| Endpoint | Fetch All Invoices |
| Method | GET |
| URL | /api/v1/invoices |
| Authentication | Bearer Token |
Request Headers:
| Header | Value | Required |
|---|---|---|
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
isp_id | integer | Yes | ISP ID |
branch_id | integer | Yes | Branch ID |
user_id | integer | Yes | User ID |
subscriber_id | integer | No | Filter by subscriber |
status | string | No | Filter by status (paid, unpaid, pending) |
from_date | date | No | Start date filter |
to_date | date | No | End date filter |
Request Body: None
Success Response (200 OK):
json
{
"success": true,
"data": {
"invoices": [
{
"id": 123,
"invoice_number": "INV-2024-0123",
"subscriber_id": 1,
"subscriber_name": "John Doe",
"amount": 1000,
"status": "paid",
"payment_date": "2024-01-15 10:30:00",
"created_at": "2024-01-01 00:00:00"
}
],
"total": 150
}
}Error Response (401 Unauthorized):
json
{
"success": false,
"message": "Unauthenticated"
}View Invoice
Retrieve details of a specific invoice.
| Property | Value |
|---|---|
| Endpoint | View Invoice |
| Method | GET |
| URL | /api/v1/invoices/{id} |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Invoice ID |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
isp_id | integer | Yes | ISP ID |
branch_id | integer | Yes | Branch ID |
user_id | integer | Yes | User ID |
Success Response (200 OK):
json
{
"success": true,
"data": {
"id": 123,
"invoice_number": "INV-2024-0123",
"subscriber_id": 1,
"subscriber_name": "John Doe",
"package_name": "10MB Package",
"amount": 1000,
"discount": 0,
"tax": 0,
"total": 1000,
"status": "paid",
"payment_method": "Cash",
"payment_date": "2024-01-15 10:30:00",
"notes": "",
"created_at": "2024-01-01 00:00:00"
}
}Error Response (404 Not Found):
json
{
"success": false,
"message": "Invoice not found"
}Update Invoice
Update an existing invoice status or details.
| Property | Value |
|---|---|
| Endpoint | Update Invoice |
| Method | PUT |
| URL | /api/v1/invoices/{id} |
| Authentication | Bearer Token |
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Invoice ID |
Request Headers:
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
Accept | application/json | Yes |
Authorization | Bearer your-auth-token | Yes |
Request Body:
json
{
"status": "paid",
"notes": "Paid via cash"
}| Parameter | Type | Required | Description |
|---|---|---|---|
status | string | No | Invoice status (paid, unpaid, pending) |
notes | string | No | Additional notes |
Success Response (200 OK):
json
{
"success": true,
"message": "Invoice updated successfully"
}Error Response (404 Not Found):
json
{
"success": false,
"message": "Invoice not found"
}Delete Invoice
Delete an invoice from the system.
| Property | Value |
|---|---|
| Endpoint | Delete Invoice |
| Method | DELETE |
| URL | /api/v1/invoices/{id} |
| Authentication | Bearer Token |
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
isp_id | integer | Yes | ISP ID |
branch_id | integer | Yes | Branch ID |
user_id | integer | Yes | User ID |
Success Response (200 OK):
json
{
"success": true,
"message": "Invoice deleted successfully"
}Error Response (404 Not Found):
json
{
"success": false,
"message": "Invoice not found"
}Error Response (400 Bad Request):
json
{
"success": false,
"message": "Cannot delete paid invoice"
}