FearlessStudios

Custom Integrations

Implement server payments and client notifications for FS-Fuel

Editable adapters

Checked against the local FS-Fuel 1.0.2 source and manifest. Use these installed paths; source builds use the corresponding files under src before building:

FileSidePurpose
config.luaSharedChoose providers, account, and pre-authorization.
dist/server/integrations/money.luaServerImplement MoneyIntegrations.custom.
dist/client/integrations/notifications.luaClientCustomize FuelNotify(message, notificationType).

All three paths are explicitly escrow-open in the inspected manifest. Back up adapter edits and merge them into new releases; do not overwrite a new adapter file with an old copy.

Custom money provider

config.lua
Config.Integrations.money = 'custom'
Config.Money.Account = 'bank'
Config.Money.PreAuth.Enabled = false

Implement the custom table in the server adapter. It is internal to FS-Fuel, not an export registration API. Start the money resource and its dependencies before FS-Fuel. Optionally set the table's resource field to the exact resource name so the provider availability check can reject it when stopped.

FunctionRequired result
GetAccountId(source)Nonempty stable account/character ID string. Never use the temporary server ID. Required for account identity even without pre-authorization.
GetBalance(source, account)Numeric balance, or nil when unavailable. Amounts are dollars with cents, such as 34.59.
RemoveMoney(source, account, amount, reason)true only after successful deduction; false on failure with balance unchanged.
AddMoney(source, account, amount, reason)true only after successful refund; false on failure. Required before enabling pre-authorization.

Do not forward deductions to client events. Use the provider's trusted server API, preserve cent precision, and adapt its return value explicitly. An asynchronous request being queued is not confirmation of a deduction. Keep supportsPreAuth = false until both refund behavior and stable account identity work.

Verified FS-Money configuration

If your server uses FS-Money, the built-in adapter already maps its server exports; you do not need to select custom:

config.lua
Config.Integrations.money = 'fs-money'
Config.Money.Account = 'bank'
Config.Money.PreAuth.Enabled = false
server.cfg excerpt, after provider dependencies
ensure FS-Lib
ensure FS-Money
ensure FS-Fuel

The adapter calls getMoney(account, source), removeMoney(account, source, amount, 'FS-Fuel', reason, false), and addMoney(account, source, amount, 'FS-Fuel', reason, false) on FS-Money. Its account ID uses the player's license. A multi-character custom economy must instead return the identity of the character/account that owns the funds.

For a different provider, copy the structure of the existing custom table and replace its nil/false stubs with your provider's verified calls. The placeholder export names in source comments are examples, not APIs supplied by FS-Fuel. Returning true without changing money makes the payment appear successful.

Pre-authorization and failure tests

Enable Config.Money.PreAuth.Enabled and set supportsPreAuth = true only after validating the full lifecycle. The default hold amount is Config.Money.PreAuth.Amount = 100, and AllowOverage defaults to false.

  1. With pre-authorization off, buy fuel with enough funds and compare the charged total to the balance and receipt. Test an insufficient balance and a stopped provider.
  2. With pre-authorization on, confirm the initial hold, a smaller completed sale, and refund of the unused portion. Test cancellation and disconnect/reconnect using the same account.
  3. Test simultaneous nozzles and any permitted overage. Confirm a shared hold is not mistaken for a separate charge per nozzle.
  4. Test an unavailable account and refund failure. Inspect server logs and account history before any manual reconciliation; avoid blindly repeating uncertain charges/refunds.

If fueling is unexpectedly free, check for money = 'none' or auto-selection of none. Auto-selection is cached and checks running FS-Money, Qbox, QB, then ESX. Start providers first and restart FS-Fuel after changing the provider.

Custom notifications

FuelNotify(message, notificationType) runs on the client, creates a notification payload, and has no consumed return value. Built-in selectors are default, ox_lib, and lation_ui. There is no existing custom branch: add your provider branch in the editable notification file and select its matching value in Config.Integrations.notifications.

Use the provider's documented client API and retain a fallback when it is unavailable. The existing default uses exports['FS-Lib']:Notify(data) with title, description, type, and duration fields. Test success/error messages and a stopped provider. Do not change payment success based on whether a notification displayed.