Skip to content

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.

PropertyValue
EndpointFetch All Invoices
MethodGET
URL/api/v1/invoices
AuthenticationBearer Token

Request Headers:

HeaderValueRequired
Acceptapplication/jsonYes
AuthorizationBearer your-auth-tokenYes

Query Parameters:

ParameterTypeRequiredDescription
isp_idintegerYesISP ID
branch_idintegerYesBranch ID
user_idintegerYesUser ID
subscriber_idintegerNoFilter by subscriber
statusstringNoFilter by status (paid, unpaid, pending)
from_datedateNoStart date filter
to_datedateNoEnd 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.

PropertyValue
EndpointView Invoice
MethodGET
URL/api/v1/invoices/{id}
AuthenticationBearer Token

Path Parameters:

ParameterTypeRequiredDescription
idintegerYesInvoice ID

Query Parameters:

ParameterTypeRequiredDescription
isp_idintegerYesISP ID
branch_idintegerYesBranch ID
user_idintegerYesUser 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.

PropertyValue
EndpointUpdate Invoice
MethodPUT
URL/api/v1/invoices/{id}
AuthenticationBearer Token

Path Parameters:

ParameterTypeRequiredDescription
idintegerYesInvoice ID

Request Headers:

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer your-auth-tokenYes

Request Body:

json
{
    "status": "paid",
    "notes": "Paid via cash"
}
ParameterTypeRequiredDescription
statusstringNoInvoice status (paid, unpaid, pending)
notesstringNoAdditional 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.

PropertyValue
EndpointDelete Invoice
MethodDELETE
URL/api/v1/invoices/{id}
AuthenticationBearer Token

Query Parameters:

ParameterTypeRequiredDescription
isp_idintegerYesISP ID
branch_idintegerYesBranch ID
user_idintegerYesUser 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"
}

www.onezeroart.com