DebitAccount
local ok, err = exports['kartik-banking']:DebitAccount(accountType, accountId, amount, reason)🔹 Description
Takes money from any account: a player's personal or Swiss account, a company account or a shared account. Use it for shops, gas stations, fines, rent or job charges.
Works for offline players too, and never takes an account below zero. Fires the onWithdraw event when it succeeds.
🔧 Parameters
| Name | Type | Required | Description |
|---|---|---|---|
accountType | string | ✅ | 'personal', 'swiss', 'company' (or 'job'), 'shared' |
accountId | string | ✅ | personal / swiss: the player's citizenid. company: the job name. shared: the account number |
amount | number | ✅ | Whole dollars, above 0 |
reason | string | ✅ | Shown in the player's transaction history |
📤 Returns
| Type | Description |
|---|---|
true | The money was taken |
false, error | Nothing was taken. error is one of the codes below |
| Error | Meaning |
|---|---|
invalid_amount | Amount missing or not above 0 |
reason_required | No reason given |
account_not_found | No account for that type and id |
account_frozen | The account is frozen |
insufficient_balance | Not enough money (DebitAccount only) |
account_not_activated | The account has no debit card yet |
transaction_failed | The money could not be moved |
🧠 Example Usage
-- Gas station charging the player's bank card
local citizenid = exports.qbx_core:GetPlayer(source).PlayerData.citizenid
local ok, err = exports['kartik-banking']:DebitAccount('personal', citizenid, 85, 'Fuel - Route 68')
if not ok then
lib.notify(source, { description = 'Card declined', type = 'error' })
end