Skip to main content

Wallet API

Developer reference for the Wallet app. The Wallet has no dedicated exports: the phone talks to the server through Bridge callbacks, the server pushes two client events, and cards are built on demand from the framework and the tables below.
Three ways to get a card into a player’s wallet from your own resource, in order of preference:
  1. A condition card in Config.Wallet.Cards — give an item, a license or a job grade and the card appears on the next open.
  2. A membership row in roadshop_wallet_cards, followed by roadphone:wallet:cardsChanged for the holder — see Issuing cards from another resource.
  3. Code inside the roadphone resource (server/serverAPI/*.lua, addons) can call the global builders directly.

Callbacks

Registered in server/wallet.lua. The phone calls them through the NUI proxies listed further down; the server never trusts a player id or identifier from the client — every distance is measured server-side and every identity is re-read from the framework. Every failure answers { ok = false, reason = … }:

Client events

Both are networked client events (RegisterNetEvent), so another server resource may trigger roadphone:wallet:cardsChanged itself after touching roadshop_wallet_cards:
Do not trigger roadphone:wallet:incoming from your own code. The phone treats its payload as an already-verified card; the distance and identity checks live in the show callback.

NUI callbacks

Registered in client/wallet.lua, for reference when you read the phone UI or write a custom app that reuses the flow.

Card schema

Every card — in getCards and in roadphone:wallet:incoming — has this shape:
meta per type: Field kind values: date, datetime (unix seconds), dob (YYYY-MM-DD), sex (m / f), height (centimetres); without kind the value is shown as text.

Global functions (inside the roadphone resource)

These are plain globals of server/wallet.lua. They are not exports — use them from server/serverAPI/*.lua, addons or other scripts that run inside the resource.

BuildWalletCards

number
required
The player’s server ID.
table
Array of card objects; empty when the player has no identifier.

BuildWalletCard

number
required
The player’s server ID.
string
required
A card id such as 'license:drive' or 'ticket:42'.
table | nil
The card, or nil when the player does not hold it.

WalletNotifyCardsChanged

Sends roadphone:wallet:cardsChanged to an online player. Safe to call for a source that is offline — nothing happens.

WalletDistance

number | nil
Distance between the two peds, or nil when either player is offline or they are in different routing buckets. The same check the show, check-in and issue paths use.

Issuing cards from another resource

Membership cards are rows in roadshop_wallet_cards. A resource that runs its own memberships (a club script, a company system) inserts the row and tells the holder’s phone:
For cards that depend on something the player has — an item, a license, a job grade — skip the table and add an entry to Config.Wallet.Cards. It needs no code and updates itself.

Events app callbacks

The Events app supplies the tickets and membership cards the Wallet shows. Registered in server/events.lua; every one answers { ok = false, reason = … } on failure. roadphone:events:changed (Server → Client) tells the phone to reload the Events app.

Rate limits


Wallet

Configuration, card types, player flow and troubleshooting

Server Callbacks

The complete callback surface of RoadPhone Pro