> For the complete documentation index, see [llms.txt](https://docs.dsyncstudios.store/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dsyncstudios.store/products/dsync-banking/integrations/server-exports.md).

# Server Exports

## Server Exports

Call these from any other server-side resource:

```lua
exports['Dsync-Banking']:ExportName(...)
```

{% hint style="warning" %}
**Every amount is in cents.** `$10.00` is `1000`. See [Why money is stored in cents](/products/dsync-banking/configuration-reference.md#why-money-is-stored-in-cents).
{% endhint %}

### Society & account management

#### `getSocietyMoney(name)`

Returns the balance (cents) of a society account.

```lua
local cents = exports['Dsync-Banking']:getSocietyMoney('police')
print(('Police funds: $%.2f'):format(cents / 100))
```

#### `getSocietyAccount(name)`

Returns the full row: `{ name, label, balance, is_frozen }`, or `nil` if the society has no account yet.

```lua
local acc = exports['Dsync-Banking']:getSocietyAccount('mechanic')
```

#### `addSocietyMoney(name, amount, reason, performedBy)`

Credits a society account. Logged to the society ledger. Returns `boolean` success.

```lua
-- Add $1,000.00 to the mechanic society
exports['Dsync-Banking']:addSocietyMoney('mechanic', 100000, 'Repair payment', 'Shop System')
```

#### `removeSocietyMoney(name, amount, reason, performedBy)`

Debits a society account. Returns `false` if funds are insufficient — a society balance can never go negative through this export.

```lua
-- Remove $500.00 from the police society
local ok = exports['Dsync-Banking']:removeSocietyMoney('police', 50000, 'Armory restock', 'Chief')
```

### Bills, fines & invoices

#### `createFine(citizenId, amount, reason, issuer, issuerAccount, dueDate)`

Issues a state/police-style fine. `issuerAccount` (optional) is the society account credited when the fine is paid; `dueDate` is optional `'YYYY-MM-DD'` (defaults to 7 days out). Returns the created bill row, or `false`.

```lua
-- $2,500.00 speeding fine, paid to the police treasury
exports['Dsync-Banking']:createFine('ABC12345', 250000, 'Speeding — 120 in a 60 zone', 'LSPD', 'police')
```

#### `createInvoice(citizenId, amount, title, description, issuer, issuerAccount, dueDate)`

Issues a business invoice (mechanic, hospital, custom job).

```lua
exports['Dsync-Banking']:createInvoice(
    'ABC12345', 80000, 'Engine Repair', 'Full engine rebuild', 'Bennys', 'mechanic'
)
```

#### `createTaxBill(citizenId, amount, taxType)`

Issues an automated tax bill, paid to the city (defaults to 30 days out).

```lua
exports['Dsync-Banking']:createTaxBill('ABC12345', 50000, 'Weekly Property Tax')
```

#### `getUnpaidBills(citizenId)`

Returns the player's pending bills.

```lua
for _, bill in ipairs(exports['Dsync-Banking']:getUnpaidBills('ABC12345')) do
    print(bill.id, bill.amount, bill.status)
end
```

#### `cancelBill(billId)`

Cancels a pending bill (e.g. issued by mistake). Returns `boolean`.

```lua
exports['Dsync-Banking']:cancelBill(42)
```

### Generic / legacy account exports

These operate directly on the `bank_accounts` database row and are intended for **shared/society/DB account IDs**. For a **personal** (player) account, the true source of truth is the player's framework balance — prefer your framework's own money functions there instead of these exports.

| Export                   | Signature                                                                 | Notes                                                                                      |
| ------------------------ | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `getAccountMoney`        | `(account)` → cents or `false`                                            | Reads the raw balance                                                                      |
| `addAccountMoney`        | `(account, amount)` → bool                                                | Logged as `Banking-External` with the calling resource name                                |
| `removeAccountMoney`     | `(account, amount)` → bool                                                | Guarded against negative balances; logged as `Banking-External`                            |
| `getAccountTransactions` | `(account)` → table                                                       | Up to 50 most recent transactions                                                          |
| `handleTransaction`      | `(account, title, amount, message, issuer, receiver, transType, transId)` | Writes a custom ledger entry — use only when you moved money yourself and need it recorded |

Valid `transType` values: `deposit`, `withdraw`, `transfer_in`, `transfer_out`, `loan_payment`, `interest`, `salary`, `bill_payment`, `fine`, `tax`, `refund`.

### Framework society compatibility

The resource declares `provide 'qb-management'` and `provide 'esx_society'`, so scripts written against those standard society interfaces resolve to Dsync-Banking automatically — no changes needed in most existing police/job scripts.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.dsyncstudios.store/products/dsync-banking/integrations/server-exports.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
