Skip to content

Invoice Endpoints

Invoices are financial records synced from Stripe. Tax invoices (NFSe) are Brazilian fiscal documents issued via ISSNet (Brasilia/DF SOAP integration).

Invoice API

Base path: /wp-json/middag-account/v1/invoices

MethodEndpointAuthScopeDescription
GET/invoicesJWT + OrgfinancesList invoices
GET/invoices/{id}JWT + OrgfinancesInvoice details
GET/invoices/{id}/pdfJWT + OrgfinancesDownload invoice PDF
GET/invoices/order/{order_id}JWT + OrgfinancesInvoices linked to an order

GET /invoices

Query filters: status (draft, open, paid, void, uncollectible), date_from, date_to.

Response (200):

json
{
    "success": true,
    "data": [
        {
            "id": 301,
            "status": "paid",
            "total": "1250.00",
            "currency": "BRL",
            "due_date": "2026-04-15",
            "paid_at": "2026-04-10T09:15:00Z",
            "order_id": 501,
            "stripe_invoice_id": "in_1abc2def3ghi"
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 20,
        "total": 1,
        "pages": 1
    }
}

GET /invoices/:id/pdf

Returns the invoice PDF as a binary download with Content-Type: application/pdf.

Tax Invoice (NFSe) Endpoints

Base path: /wp-json/middag-account/v1/tax-invoices

MethodEndpointAuthScopeDescription
GET/tax-invoicesJWT + OrgfinancesList NFSe
GET/tax-invoices/{id}JWT + OrgfinancesNFSe details
GET/tax-invoices/{id}/pdfJWT + OrgfinancesDownload NFSe PDF
GET/tax-invoices/order/{order_id}JWT + OrgfinancesNFSe linked to an order

GET /tax-invoices

Query filters: status (pending, issued, cancelled, error).

Response (200):

json
{
    "success": true,
    "data": [
        {
            "id": 55,
            "status": "issued",
            "nfse_number": "2026000123",
            "total": "1250.00",
            "issued_at": "2026-04-12T10:00:00Z",
            "order_id": 501
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 20,
        "total": 1,
        "pages": 1
    }
}

Invoice Statuses

StatusDescription
draftInvoice created but not finalized
openFinalized and awaiting payment
paidPayment received (terminal)
voidVoided / cancelled (terminal)
uncollectibleMarked as uncollectible after failed attempts

Tax Invoice Statuses

StatusDescription
pendingAwaiting issuance via ISSNet
issuedSuccessfully issued with NFSe number
cancelledCancelled in the municipal system (terminal)
errorIssuance failed -- retry via pending