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

# License Center

Timed theory exams. Players pay a fee, answer random questions and earn the license when they reach the pass mark.

## Defining a license

Licenses live in `config/licenses.lua`:

```lua theme={null}
{
    id          = 'car',                    -- stored in the database, keep it stable
    label       = 'Driving License',
    description = 'Required to drive standard passenger vehicles.',
    icon        = 'Car',                    -- Car, Motorcycle, Truck, Anchor, Plane, Crosshair, Badge
    cost        = 500,                      -- test fee (Config.MoneyAccount)
    passingPct  = 80,                       -- % needed to pass
    timeLimit   = 600,                      -- seconds
    questions   = {
        {
            id      = 'car_1',
            text    = 'What does a red traffic light mean?',
            answers = {
                { id = 'a', text = 'Stop' },
                { id = 'b', text = 'Speed up' },
                { id = 'c', text = 'Turn right' },
            },
            correct = 'a',
        },
        -- …
    },
},
```

> [!WARNING]
>
> Each pool should contain at least `Config.Settings.questionsPerTest` questions. Correct answers are checked on the server and never sent to the player.

## How a test works

* The fee (or `Config.PaymentItem`) is taken when the test starts.
* Closing the window or pressing Esc during a test asks for confirmation. Quitting forfeits the fee.
* On a fail the player waits `Config.Settings.cooldownSeconds` before retrying and gets `Config.FailRefundPct` of the fee back (no refund when a payment item was used).
* On a pass the license is saved and `Config.OnLicenseEarned` runs on the server and the client (e.g. to give an item).


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