The Aplauso API supports three isolated data environments. Every business logic endpoint accepts an environment parameter to control which environment is used for reads and writes, and employee, department, and property records can expose a server-resolved resolvedEnvironment to downstream clients.
Environments
| Environment | Purpose | Stripe Mode |
|---|---|---|
live | Production data; real payments | Live Stripe keys; real charges |
sandbox | Development and staging; no real money | Test Stripe keys; no real charges |
demo | Clean demo data; presentations and training | Test Stripe keys; no real charges |
Passing the Environment Parameter
As a query parameter:
GET /v2/analytics?type=employee&employeeId=abc123&environment=sandbox
Or in the request body:
{
"employeeId": "abc123",
"amount": 10.00,
"environment": "sandbox"
}
If omitted, the API defaults to live.
Resolved Environment on Entities
Environment is resolved hierarchically for operational entities:
- Employee
activeEnvironment - Department
activeEnvironment - Property
activeEnvironment - Default
live
API responses for employees, departments, and properties can include a resolvedEnvironment field so clients do not need to rebuild the inheritance logic themselves.
This is what kiosk and dashboard should trust when deciding whether to operate in live, sandbox, or demo.
Updating an Entity Environment
Admins can update the active environment through dedicated PATCH endpoints:
PATCH /v2/live/properties/{id}/environment
PATCH /v2/live/departments/{id}/environment
PATCH /v2/live/employees/{id}/environment
Example request body:
{
"activeEnvironment": "sandbox",
"cascade": true,
"reason": "Enable training"
}
These endpoints validate permissions, reject invalid environments, and write audit events for the change.
Data Isolation
Each environment stores data completely separately:
- A tip created in
sandboxnever appears inlivetip queries. - Guest identity records are shared across environments. The environment boundary applies to the tipped or rated target and to transactional records such as tips, ratings, visits, and dividends.
- Wallet balances are maintained per environment (
wallet.live,wallet.sandbox). - Stripe account IDs are separate per environment (one Express account per user per environment).
- Analytics are computed separately per environment.
Returning from Sandbox to Live
Switching a property, department, or employee from sandbox back to live also clears sandbox transactional data for that scope.
- Sandbox visits, ratings, tips, and related dividend records are purged during the rollback.
- Guest profiles are not purged because they are not environment-specific.
- After the rollback, kiosk and dashboard clients return to live data only.
Testing in Sandbox
To run a full end-to-end test in sandbox:
- Create a tip with
environment: "sandbox". - Use the sandbox Stripe keys to create a Payment Intent (the API handles this automatically when
environmentissandbox). - Use a Stripe test card number to simulate payment:
| Card Number | Result |
|---|---|
4242 4242 4242 4242 | Payment succeeds |
4000 0000 0000 0002 | Card declined |
4000 0000 0000 9995 | Insufficient funds |
Any future expiry date, any 3-digit CVC, any billing ZIP.
- The sandbox Stripe webhook delivers a
payment_intent.succeededevent. - The tip status updates to 20 (Paid) and dividends are created.
- Query
/v2/tips?environment=sandboxand/v2/dividends?environment=sandboxto verify.
Environment in the Kiosk and Dashboard
The kiosk app (k.aplauso.io) and dashboard (my.aplauso.io) display a colored environment banner when running in a non-live environment:
| Environment | Banner |
|---|---|
live | No banner (normal operation) |
sandbox | Orange training banner |
demo | Red demo banner |
The environment is controlled server-side per recipient or employee context. If a recipient or signed-in employee resolves to sandbox or demo, kiosk and dashboard automatically route their API traffic and Stripe behavior to the matching environment.
Employee-level overrides can also be applied through supported admin or self-service flows. In all cases, clients should trust the API-resolved environment rather than deriving it from a URL or local-only setting.
Local Development
When running the Firebase emulators locally, the API automatically uses test Stripe keys regardless of the environment parameter. This ensures no real charges occur during local development.
cd api
npm run serve
# Firebase emulators start on localhost:5001
Point your frontend apps at the local emulator base URL for testing:
http://localhost:5001/aplauso-f0501/us-central1/internal/v1/