> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roadshop.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Exports

> Server and client exports for integrating RoadBanking with other scripts

# Exports

Call the exports on `exports.road_banking`. Unless noted, they are
server-side.

## Targets

Most exports take a `target`. It can be:

| Value | Account |
| - | - |
| Player server id (number) | That player's checking account |
| Account number (string, with or without spaces) | That account |
| Job name with a business account (string) | The job's business account |
| Framework identifier (string) | That player's checking account, if it exists |

Amounts are whole numbers above zero.

## Accounts

### GetPersonalAccount

**target** `number | string` *required*

See [Targets](#targets)

**return** `string | nil`

The account number of the checking account, or `nil`.

```lua theme={null}
local number = exports.road_banking:GetPersonalAccount(source) -- 'LS1234567890'
```

### GetAccount

**target** `number | string` *required*

See [Targets](#targets)

**return** `table | nil`

**properties**

**number** `string`

Account number

**type** `string`

`personal`, `savings`, `shared` or `business`

**label** `string`

Display name

**owner** `string`

Identifier of the owner, or the job name

**balance** `number | nil`

`nil` for a checking account whose owner is offline

**frozen** `boolean`

Frozen by an admin

```lua theme={null}
local account = exports.road_banking:GetAccount('police')
print(account.label, account.balance)
```

### GetBalance

**target** `number | string` *required*

See [Targets](#targets)

**return** `number`

The balance. `0` when the account does not exist or is a checking account
whose owner is offline.

## Money

### AddMoney

Pays money into an account and adds a history line.

**target** `number | string` *required*

See [Targets](#targets)

**amount** `number` *required*

Whole amount above zero

**reason** `string`

Shown in the history (up to 120 characters)

**return** `boolean`

`true` when the money was booked.

```lua theme={null}
exports.road_banking:AddMoney(source, 2500, 'Paycheck')
```

### RemoveMoney

Takes money from an account and adds a history line. Refuses overdrafts and
frozen accounts.

**target** `number | string` *required*

See [Targets](#targets)

**amount** `number` *required*

Whole amount above zero

**reason** `string`

Shown in the history (up to 120 characters)

**return** `boolean`

`true` when the money was taken.

```lua theme={null}
if exports.road_banking:RemoveMoney(source, 800, 'Vehicle repair') then
    -- repair the vehicle
end
```

### Transfer

Moves money between two accounts, with history lines on both sides. The
recipient is notified. No transfer fee is charged.

**from** `number | string` *required*

Paying account, see [Targets](#targets)

**to** `number | string` *required*

Receiving account

**amount** `number` *required*

Whole amount above zero

**reference** `string`

Shown in both histories (up to 120 characters)

**return** `boolean, string | nil`

`true` on success, otherwise `false` and an error code such as
`insufficient_funds`, `account_frozen`, `owner_offline` or
`invalid_request`.

```lua theme={null}
local ok, code = exports.road_banking:Transfer(source, 'mechanic', 1500, 'Tuning')
```

### AddTransaction

Adds a history line for money your script moved itself, for example through
the framework's own bank functions. The balance does not change.

**target** `number | string` *required*

See [Targets](#targets)

**amount** `number` *required*

Positive for incoming, negative for outgoing money

**reference** `string`

Up to 120 characters

**counterpartyName** `string`

Who paid or was paid (up to 64 characters)

**return** `boolean`

```lua theme={null}
exports.road_banking:AddTransaction(source, -45, 'Fuel', 'Globe Oil')
```

### GetTransactions

**target** `number | string` *required*

See [Targets](#targets)

**limit** `number` (default: 20)

Up to 100

**return** `table`

Newest first.

**entry**

**id** `number`

Ledger id

**kind** `string`

For example `deposit`, `withdraw`, `transfer_in`, `transfer_out`, `fee`, `interest`, `external`

**amount** `number`

Negative for outgoing money

**counterparty** `string`

Other account number, if any

**counterpartyName** `string`

Other party's name, if any

**reference** `string`

Reference text

**createdAt** `number`

Timestamp in milliseconds

## Invoices

### CreateInvoice

Sends an invoice to an online player, for fines, shops or services. The
recipient pays it in the bank.

**data** `table` *required*

**properties**

**target** `number` *required*

Server id of the player who pays

**amount** `number` *required*

Whole amount above zero, up to `Config.Invoices.MaxAmount`

**reason** `string`

Shown on the invoice (up to 120 characters)

**job** `string`

Business account that receives the money

**sender** `number`

Server id of the sending player; the money goes to their checking account. Give `job` or `sender`.

**return** `boolean, number | string`

`true` and the invoice id, or `false` and an error code.

```lua theme={null}
exports.road_banking:CreateInvoice({ target = playerId, amount = 500, reason = 'Speeding', job = 'police' })
```

## Credit score

### GetCreditScore

**target** `number | string` *required*

Player server id or framework identifier

**return** `number | nil`

The score from 300 to 850, without the points for money held, which are
only counted at the bank.

## Client

### IsOpen

**return** `boolean`

`true` while the bank or ATM screen is open.

```lua theme={null}
if exports.road_banking:IsOpen() then return end
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.