> For the complete documentation index, see [llms.txt](https://docs.okokscripts.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.okokscripts.io/scripts/okokbillingv3/exports.md).

# Exports

Server-side

### **Send Invoices**

```lua
exports['okokBilling']:CreateInvoice(receiver, amount, reason, author)
```

**Example: Society Invoice**

Send a 500€ speeding fine to a player on behalf of the police department.

```lua
exports['okokBilling']:CreateInvoice(12, 500, 'Speeding', 'police')
```

**Example: Personal Invoice**

Send a 200€ invoice directly from one player to another.

```lua
exports['okokBilling']:CreateInvoice(39, 200, 'Cleaning Vehicle', 7)
```

#### Parameters

<table data-header-hidden data-search="false"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Description</strong></td></tr><tr><td><code>receiver</code></td><td>Server ID of the player or society ID receiving the invoice</td></tr><tr><td><code>amount</code></td><td>Invoice amount</td></tr><tr><td><code>reason</code></td><td>Reason or description of the invoice</td></tr><tr><td><code>author</code></td><td>Server ID of the player or society ID sending the invoice</td></tr></tbody></table>

### **Fetch Invoices**

Use this server-side export to retrieve invoices associated with a specific player.

```lua
local invoices = exports['okokBilling']:getInvoices(target)
```

#### Parameters

|               |                                       |
| ------------- | ------------------------------------- |
| **Parameter** | **Description**                       |
| `target`      | Server ID of the player or society ID |

#### Example Response:

```lua
{
    id = 12,
    ref_id = 'OKA1B2C3D4',
    sender = 'LSPD',
    receiver = 'John Doe',
    reason = 'Speeding ticket',
    amount = 1500,
    fees = 0,
    status = 'pending',
    items = {
        { id = '1', item = 'Speeding ticket', qty = 1, price = 1500 }
    },
    dueDate = '2026-04-24 18:00:00',
    receivedDate = '2026-04-17 18:00:00',
}
```

### **Pay Reference**

```lua
exports['okokBilling']:payReference(payer, 'OKA1B2C3D4')
```

#### Parameters

|               |                                                   |
| ------------- | ------------------------------------------------- |
| **Parameter** | **Description**                                   |
| `payer`       | Server ID of the player that will pay the invoice |
| `reference`   | Unique reference number of the invoice to pay     |
