Capabilities and Credits¶
The Scorbit SDK allows your game to declare its capabilities and manage credits. Capabilities tell the Scorbit platform what your machine supports, enabling features like remote game start and mobile payments.
Capabilities¶
Capabilities are declared after creating the game state. They inform the Scorbit platform which features the machine supports, so the mobile app can present the appropriate options to players.
Available Capabilities¶
| Capability | Description |
|---|---|
StartGame |
The machine supports starting a game remotely from the Scorbit app |
CreditDrop |
The machine supports adding credits via mobile payment |
Declaring Capabilities¶
Call setCapabilities after creating the game state. Capabilities can be combined using the bitwise OR operator.
You can also declare a single capability:
When to Set Capabilities
Set capabilities once after creating the game state, before entering the main game loop. This allows the Scorbit platform to know what the machine supports as soon as it connects.
Credits¶
The credits API allows your game to report credit transactions and status to the Scorbit platform. This is used in conjunction with the Event System — specifically the CreditsAddRequested and CreditsStatusRequested events.
Confirming a Credit Drop¶
When you receive a CreditsAddRequested event and successfully add credits to the machine, confirm the transaction by calling setCreditsDropped:
If the credit drop failed (e.g., the machine is unable to accept credits), pass false for the success parameter:
Reporting Credit Status¶
When you receive a CreditsStatusRequested event, report the current credit state of the machine:
Credits Parameters¶
setCreditsDropped¶
| Parameter | Type | Description |
|---|---|---|
credits |
integer | Number of credits that were added |
transaction |
string | Transaction ID from the CreditsAddRequested event |
success |
boolean | Whether the credits were successfully added to the machine |
setCreditsStatus¶
| Parameter | Type | Description |
|---|---|---|
freePlay |
boolean | Whether the machine is in free play mode |
credits |
integer | Current number of credits on the machine |
maxCredits |
integer | Maximum number of credits the machine can hold |
pricing |
string | Pricing description (e.g., "$1.00 per play") or NULL/empty |
Typical Flow¶
- At startup, declare capabilities:
setCapabilities(StartGame | CreditDrop) - Receive
CreditsAddRequestedevent with credit count and transaction ID - Add credits to the machine
- Confirm with
setCreditsDropped(credits, transaction, true) - When
CreditsStatusRequestedis received, report withsetCreditsStatus(...)
For complete examples including event handling, refer to the Events page and the Scorbit SDK examples.