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.
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.
Data Isolation
Each environment stores data completely separately:
- A tip created in
sandboxnever appears inlivetip queries. - 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.
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
The kiosk app (k.aplauso.io) displays a colored environment banner when running in a non-live environment:
| Environment | Banner |
|---|---|
live | No banner (normal operation) |
sandbox | Orange "SANDBOX MODE" banner at top |
demo | Red "DEMO MODE" banner at top |
The environment is controlled server-side per recipient (employee/outlet/department). If a recipient's record is set to sandbox, the kiosk automatically operates in sandbox mode when that recipient's URL is opened.
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/api/v2/