# Static Riot RGS evaluation integration

Contract: `2026-10-evaluation-v1` · funds: developer credits · unit currency: EUR.

## What is operational

Static Riot's Remote Gaming Server evaluation core creates private developer sessions, samples complete rounds on the server, settles their integer-cent debit and credit atomically, and stores immutable receipts and exact replay data. Outlaw's Go Wild and Dracula's Lair share a 6×5 Cluster Pays model; Poseidon's Fall uses a separate versioned 5×4 payline model on the same RGS. Browser launches use a short-lived, single-use opaque capability and an HttpOnly session cookie; API keys never appear in a launch URL.

This service does **not** accept deposits, create redeemable balances, debit an external casino wallet or enable real-money play. External-wallet integrations require a partner-approved specification and acceptance testing. Commercial licence enquiries and Developer Tools subscriptions do not enable a live wagering environment.

## Access and versioning

- Base URL: `https://staticriot.dev/api/integration/v1`.
- OpenAPI: `/openapi.json`; public release status: `GET /health`; game catalogue: `GET /games`.
- Use `Authorization: Bearer sr_sandbox_…` from your backend. Keys belong to the signed-in developer, require active Developer Tools access and can be revoked in the console. Cookie login is not accepted on these partner endpoints.
- Existing key allowance: 1,000 API calls per UTC day and up to five active keys. Browser RGS requests share their launch key's allowance. Sessions are additionally limited to 10 new sessions per developer per 24-hour window; wagers to 60 complete rounds per developer per minute; launch capabilities to 30 per minute.
- An API key is a developer credential, not an operator wallet or real-money credential. The only implemented scope is sandbox evaluation. Financial endpoints are private to the owning developer; health and game catalogue are public.
- Send `Content-Type: application/json` (optional charset) with integer cents to the RGS. Financial responses identify `environment: "sandbox"`, `funds: "developer_credits"`, `currency: "EUR"`, `redeemable: false` in their top-level payload or nested session/receipt.
- Dates are Unix seconds. The API contract version and frozen math model version are separately disclosed. No wildcard browser CORS access is enabled; call the partner API from your backend.

## 1. Create a session

```http
POST /api/integration/v1/sessions
Authorization: Bearer sr_sandbox_…
Idempotency-Key: <new UUID>
Content-Type: application/json

{"game":"outlaw","environment":"sandbox","funds":"developer_credits","currency":"EUR"}
```

`201` returns `{ "session": { "id": "…", "balanceCents": 100000000, ... } }`.

Each session has EUR 1,000,000 of non-redeemable developer credits, enough to evaluate the maximum EUR 400 base bet and EUR 400,000 Epic buy. It expires after 24 hours. There is no automatic refill or balance-edit endpoint. This deliberately differs from the standalone browser demo's convenience refill. Use a new session to start a new evaluation; creation limits still apply.

Session creation requires all four fields above. Use `outlaw`, `dracula` or `poseidon` when the requested title is enabled. Check `GET /games` for current availability. Live mode, another currency, client balances, outcome indexes, RNG seeds and unknown fields are rejected.

## 2. Settle a complete round

```http
POST /api/integration/v1/sessions/{sessionId}/rounds
Authorization: Bearer sr_sandbox_…
Idempotency-Key: <new UUID for this wager; retain for every retry>
Content-Type: application/json

{"mode":"hunt","betCents":100}
```

Modes and total debit:

| Mode | Meaning | Debit at a EUR 1 base bet |
| --- | --- | ---: |
| `base` | Standard base round | EUR 1 |
| `hunt` | Feature Bet; five times the natural bonus chance | EUR 3 |
| `first` | First bonus, initially eight free spins | EUR 120 |
| `second` | Second bonus, initially twelve free spins | EUR 240 |
| `epic` | Epic bonus, initially twelve free spins | EUR 1,000 |

The table above describes Outlaw's Go Wild and Dracula's Lair. Poseidon's Fall supports `base` (EUR 1), `hunt` (EUR 3), `first` / Siren Tide (EUR 120) and `second` / Abyss Expedition (EUR 240) at a EUR 1 base bet. Both Poseidon buys start with ten free spins. Poseidon rejects `epic`. It accepts the published 36 base-bet values from EUR 0.05 through EUR 400, rather than every whole-cent value in that interval. Its full rules, symbol paytable, FS retriggers, expanding wilds and 98% internally calculated finite model are at [`/poseidon-math`](https://staticriot.dev/poseidon-math). Poseidon has no independent math certification or real-money wallet connection.

`betCents` is a whole number from 5 to 40,000 inclusive, representing the **selected base bet**, not the total buy or Feature Bet cost. The server calculates and validates the full debit; an insufficient session never overdrafts or refills.

`201` returns `{ "receipt": { ... }, "result": { ... } }`. The receipt contains an immutable round ID, monotonically increasing session sequence, `state: "settled"`, base bet, full debit, total credit, before/after balances, model version and SHA-256 result hash. `result` is the complete `playRound` response including every paying cluster, coin, pot, multiplier, bonus spin, minimum top-up and cap adjustment needed by the renderer.

**The whole round, including any triggered or purchased free-spin sequence, settles in one transaction before its animation plays.** The browser can count up through its event ledger, but must finish at the returned balance. An interrupted animation does not cancel the settled round. This is not a multi-call external-wallet free-spin protocol.

## Idempotency, concurrency and failure handling

- Session creation and each round require an `Idempotency-Key` of 16–128 characters: letters, digits, underscores, dots, colons or hyphens, beginning with a letter or digit. UUIDs are suitable.
- Session-creation keys are scoped to the developer. Round keys are scoped to the session. Persist the key and exact request before sending a wager.
- An identical retry returns the original receipt and exact result, with response header `Idempotent-Replayed: true`. Reusing a key for another request returns `409 IDEMPOTENCY_CONFLICT`.
- A duplicate request cannot debit twice. A single SQLite insert and its validation/settlement triggers atomically record the immutable round and update the session balance and sequence. Concurrent distinct requests serialize against the current balance. No client-supplied settlement is trusted.
- Retry a timeout or `503` using the **same** key. Do not assume the wager failed and issue a new key. A disconnect after commit can still represent a settled round.
- If the round ID was lost, use `GET /sessions/{id}/rounds/by-key` with the original `Idempotency-Key` header. `200` returns the original settled receipt and result without a new debit. `404 NOT_FOUND` means no settled receipt was visible at that instant; an earlier request can still be in flight. Retry the original POST with the same key and body. Never use a different key to resolve an uncertain wager.
- Receipts and key uniqueness remain available after a session expires or closes. There is no public history-deletion endpoint. Retention and deletion obligations for a future live integration must be agreed separately; this evaluation contract is not a permanent-retention promise.

### Recovery sequence

1. Durably store the operator-side request ID, session ID, exact mode and integer stake **before** sending. Use one unique key per business wager and restrict access to these records.
2. A `201` is a newly settled round; a `200` with `Idempotent-Replayed: true` is the same already-settled round. Save the returned round ID, model, receipt and result hash. Verify `balanceBeforeCents - debitCents + creditCents == balanceAfterCents`.
3. For a network failure or `5xx`, back off and repeat the identical POST using the original key. For `429`, follow the numeric `Retry-After` seconds; the daily allowance resets at midnight UTC. Do not spin in a retry loop while quota is exhausted. Authentication, rate limits and game availability can delay recovery; retain the original request until resolved.
4. Read the keyed receipt or exact replay, then reconcile the session. Do not independently credit money from the replay: it describes an already-completed settlement.
5. If a `409 IDEMPOTENCY_CONFLICT`, reconciliation mismatch or unresolvable uncertainty remains, stop new wagers for that session and investigate the immutable records. There is no client-controlled refund/rollback endpoint in this evaluation API.

## 3. Inspect and reconcile

| Request | Result |
| --- | --- |
| `GET /sessions/{id}` | Current developer-credit balance, expiry, state and round count |
| `GET /sessions/{id}/rounds?limit=20&beforeSequence=N` | Newest-first receipts; `limit` 1–50; exclusive sequence cursor |
| `GET /sessions/{id}/rounds/by-key` + `Idempotency-Key` | Look up a settled round when its response/round ID was lost; does not place a wager |
| `GET /sessions/{id}/rounds/{roundId}` | Full original receipt and result for replay |
| `GET /sessions/{id}/reconciliation` | Initial balance, aggregate debits and credits, current balance and consistency flag from one database snapshot |
| `DELETE /sessions/{id}` | Idempotently closes the session for new wagers; history and safe retries remain readable |

Reconciliation verifies `initialBalanceCents - debitCents + creditCents == balanceCents` and checks the receipt count. Replays do not perform a new wager and do not change any award. Regular API quota still applies.

History pages are read-only snapshots. Continue with `nextBeforeSequence` until it is `null`, retaining the cursor from each response rather than an array offset. A new round may be inserted while paging; take the first page's newest sequence as your report boundary and reconcile after the active session is quiescent if comparing a complete export with one aggregate.

## 4. Launch the game renderer

From your backend or the developer console, call:

```http
POST /api/integration/v1/sessions/{sessionId}/launch
Authorization: Bearer sr_sandbox_…
Content-Type: application/json

{}
```

`201` returns a relative `launchUrl` whose `#launch=…` fragment contains a one-use, random 256-bit capability. It expires in five minutes and is stored only as a hash. Open this URL on the same Static Riot origin. Never log, publish or forward the capability; it grants access to the specified evaluation session.

The renderer removes the fragment before loading the game and exchanges the capability using same-origin `POST /api/rgs/v1/launch/exchange` with `{ "launchToken": "…" }`. The server consumes it atomically and sets an `sr_rgs` cookie: HttpOnly, Secure over HTTPS, SameSite=Strict, scoped to `/api/rgs/v1/browser/sessions/{sessionId}`. It is bound to one session and expires with that session. Separate sessions can launch in parallel without overwriting each other's cookies. A consumed capability cannot be exchanged again. If its response was lost, issue a new launch capability with the developer key.

Browser requests use `/api/rgs/v1/browser/sessions/{id}` and its rounds/reconciliation subpaths. They use the same server engine, receipts and idempotency rules. Mutations require an exact same-origin `Origin` header. The browser cookie cannot open another session, create sessions or issue launch capabilities. Key revocation, account suspension or removal of developer access invalidates browser access. A game marked unavailable refuses new rounds but retains replay/history access.

An iframe on another casino origin is not an approved launch integration: `SameSite=Strict` cookies and same-origin mutation checks deliberately constrain this evaluation renderer. Agree the hosted launch/embedding and wallet contracts before integrating an operator frontend. An API bearer key must never be sent to player JavaScript, iframe URLs, analytics or customer support logs.

## 5. Developer math and simulation tools

These endpoints use the same sandbox bearer key and daily allowance, on the separate `/api/v1` base path. They inspect/sample the math; they do **not** create RGS sessions, debit developer balances, save receipts or make a redeemable award. Simulation requests are repeatable sampling jobs, not idempotent wagers.

| Request | Contract |
| --- | --- |
| `GET /api/v1/math` | Frozen model/version, published paytables, bonus names/rules, feature limits, both games' symbol factors and `certified: false` |
| `POST /api/v1/simulate` | `application/json` object, accepted fields only: `game`, `spins`, `mode`, `tier`, `hunt`, `bet` |

```json
{"game":"dracula","mode":"bonus","tier":"epic","spins":100,"bet":1}
```

`game`: `outlaw` or `dracula` (default `outlaw`). `spins`: integer 1–5,000 complete rounds (default 100). `mode`: `base` or `bonus` (default `base`). `tier`: `first`, `second` or `epic` (default `first`; only affects Bonus mode). `hunt`: boolean (default false), only `true` in Base mode. `bet`: a JSON number in whole EUR cents from 0.05 through 400 (default 1); unlike the RGS's `betCents`, this field is in **EUR units**. To test Feature Bet, send `{"game":"outlaw","mode":"base","hunt":true,"spins":100,"bet":1}`.

The result includes `model`, `game`, `baseBet`, `spins`, `totalWager`, `totalWin`, `observedRtp`, `hitRate`, `maxWin`, `bonusTriggers`, `targetRtp: 98` and an uncertified/high-volatility warning. An observed sample RTP can differ greatly from the theoretical 98%; neither a small demo run nor this HTTP test validates a certification claim.

Developer-tool errors retain the legacy `{ "error": "message" }` shape, unlike the structured RGS errors below. Read the HTTP status first. `400` is invalid input, `401` invalid/revoked/inactive access, `405` wrong method (`Allow` identifies supported methods), `413` oversized body, `415` wrong media type, `429` quota exhausted (`Retry-After`), `503` unavailable game/service. The simulation body limit is 32,768 bytes. There is no `/api/v1/games`; use the public RGS catalogue instead.

## Integration acceptance record

Before connecting a partner, retain a versioned acceptance report for **both** `outlaw` and `dracula`, each of Base, Feature Bet, First, Second and Epic, using min/max stakes and normal stakes. Record the exact API contract, math model, game ID, key/account ownership, initial balance, debit/credit totals, final reconciliation and release identity. At minimum, exercise:

- New wagers, identical duplicate requests, conflicting requests, simultaneous wagers, rejected insufficient funds and session closure/expiry.
- Lost responses after settlement, retry after restart, keyed receipt lookup, replay/hash verification, all history pages and final ledger reconciliation.
- One-use/expired launches, cross-session cookies, disallowed origins, revoked keys, suspended/expired developer access, disabled games and enforced quotas.
- The actual partner adapter's external-wallet rejection/timeout/rollback/recovery cases once its approved specification and staging wallet are available.

An operator player ID, operator transaction ID, external currency, return URL or wallet token is not accepted by these current session endpoints. Maintain those mappings in an authorized backend during evaluation; they are not evidence that an external wallet is connected.

## Local mock casino wallet lab

Run `node scripts/mock-wallet-check.mjs` from the source repository to exercise a separately persisted mock casino wallet over loopback HTTP. A standalone source bundle is available at `/wallet-lab-kit.zip`; extract it and run the same command with Node.js 22.13 or newer, without installing dependencies. `/wallet-lab-results.json` is a static record of a completed local run. **Status: LOCAL MOCK LAB ONLY.** No live key, customer payment, casino balance or deployed wallet endpoint is involved. The mock contract is designed for fault injection; it is not an operator or aggregator's approved protocol.

The lab uses the frozen engine for both games and all five modes, with integer-cent debit/payout/rollback accounting, duplicate and conflicting requests, ownership checks, lost or delayed responses, retries, cancellation-before-debit and restart recovery. It persists the selected outcome before debit and preserves the original transaction IDs through recovery. A payout of uncertain status must be recovered, not followed by an automatic debit refund. Sampling these test rounds does not measure or recertify the 98% theoretical RTP.

The deployed RGS remains a developer-credit evaluation service. The separate browser sandbox connector described below can test a developer-controlled wallet. Before a production external wallet can be enabled for wagering, Static Riot still needs the partner's approved protocol and staging credentials, a matching authenticated wallet/launch adapter, successful bilateral fault/reconciliation acceptance tests, required certification and market approval, operational/security readiness and commercial launch sign-off. See `testing/wallet-lab/README.md` in the source package for the local lab's run and recovery notes.

## Run hosted wallet tests in the developer console

Open `/console.html#wallet-lab` with an active Developer Tools account. Choose both games, Outlaw's Go Wild or Dracula's Lair and select **Run wallet tests**. No API key entry, command line or download is required. The console shows fresh server-executed case results, progress, assertion counts and transaction details. Recent runs belong to the signed-in developer; incomplete runs can be resumed after navigation or a lost response.

This hosted suite uses the actual frozen game engine and an isolated mock transport. It exercises debit, payout, rollback, retry and failure-handling rules with fake EUR credits. Its report identifies `scope: "hosted_mock_transport"`. The standalone downloadable lab separately tests local SQLite and signed loopback HTTP. Hosted results do not claim to execute Node.js, local sockets or a partner's staging wallet inside a browser.

These console routes use the website's HttpOnly `sr_session` cookie and active Developer Tools entitlement, rather than a developer Bearer key. POST requests require the same-origin `Origin` header. They do not spend the API key's daily allowance or change the developer demo balance, RGS session balance, licence or billing account.

| Request | Action |
| --- | --- |
| `GET /api/wallet-lab/runs` | Read recent runs for the current developer |
| `POST /api/wallet-lab/runs` | Create an isolated run with `{ "game": "both" }`, `"outlaw"` or `"dracula"`; retain its `Idempotency-Key` UUID for retries |
| `GET /api/wallet-lab/runs/{id}` | Read saved progress and completed case results without advancing it |
| `POST /api/wallet-lab/runs/{id}/advance` | Send `{}` to execute the next bounded test step and save its result |

A run is `running` until every planned case completes, then `passed` or `failed`. Failed cases remain visible. The console advances cases serially and can pause between requests; closing a page does not delete the saved report. Mutation retries and concurrent tabs cannot append a case twice. New-run limits protect the hosted test service; the response supplies `Retry-After` when a limit applies. Ownership checks, current entitlement and CSRF rules apply on every request.

## Connect your own sandbox wallet in the console

Open `/console.html#external-wallet-lab` with Developer Tools access. Configure your wallet using the readable contract at `/sandbox-wallet.html` and the separate outbound OpenAPI at `/sandbox-wallet-openapi.json`. Enter its HTTPS API base URL, a dedicated EUR test-player ID and a limited sandbox Bearer token. Confirm test-only use and connect. The handshake must identify `static-riot-sandbox-wallet-v1`, sandbox test credits and `redeemable: false` before any transaction is sent.

Choose either slot or both. The browser samples and journals each original frozen game outcome, then calls **your** wallet directly for debits, payouts, rollbacks and receipt lookups. It checks integer-cent amounts, balance movement, exact duplicate receipts and conflicts. Five mode settlements use a €0.05 base bet (Base, Feature Bet and 120×/240×/1,000× bonus buys). Other scenarios exercise retry, zero payout, rollback and client-injected faults before dispatch or after a response is received. These injected faults model a client's missing response; they do not assert that your wallet crashed, delayed its commit or failed its database transaction.

Reports are labelled **browser-observed sandbox tests**. Recovery journals, selected endpoint and test-player ID remain in this browser, scoped to the Static Riot account. Terminal report snapshots are saved privately to the developer account with wallet URLs, player IDs, account identifiers, credentials and pending request bodies removed. The Bearer token stays in page memory and is sent only to the selected wallet; it is not saved in the journal, sent to a Static Riot API or included in report snapshots. Reconnect after a reload to resume the original local journal. Do not clear browser storage while transactions remain unresolved. Use a dedicated test player without another tool changing its balance during a run.

Your wallet must permit the console's exact origin through CORS, support the v1 contract and retain original transaction receipts. An arbitrary existing casino API is not automatically compatible. Browser requests omit cookies and reject redirects; production endpoints must use a public DNS hostname over HTTPS on port 443, without URL credentials, query parameters or fragments. Loopback HTTP is available only when the console itself is running on a local preview. No hosted server proxy accepts a destination URL or a wallet credential.

A journal write must succeed before each outgoing mutation. A timeout, interrupted browser request or missing receipt does not establish that the wallet failed to commit. The saved operation is resolved by receipt lookup and an identical retry with the original transaction ID. Invalid or contradictory receipts stop the run for review. Never refund a debit simply because a payout's response is uncertain. Browser tab coordination prevents two copies of this console from driving the same account's journal simultaneously; it does not replace wallet-side idempotency.

This connector does not connect live RGS gameplay to the wallet, accept redeemable funds, prove certification or measure the 98% theoretical RTP. Game math and RGS balances are unchanged. A partner's server wallet adapter and commercial acceptance remain separate work.

## Account-saved reports and sharing

Open `/console.html#wallet-reports` to reopen stored reports on any device signed in to the same account. Completed, failed and review-required terminal snapshots are saved from the console. Existing terminal runs in this browser can also be saved; an offline failure leaves the local journal available for a later retry. Running or paused recovery journals are not transferred to another device, and opening a saved report never sends a wallet transaction.

Reports contain both games' selected scenarios, the math model, original outcome hashes, planned cents, observed receipts, assertions and closing balance reconciliation when available. The server validates the shape and accounting consistency, removes connection details and free-form wallet data, recomputes summary counts and stores an immutable normalized snapshot with a SHA-256 content hash. Uploading the same owner/run snapshot again returns the existing report; changing a previously stored snapshot returns a conflict. A stored hash proves which snapshot was saved, not that an external wallet observation was independently verified. The report remains labelled `scope: "browser_observed"`, `certified: false` and non-redeemable test credits.

Reports are private by default. **Create share link** explicitly grants anyone holding that link read access to the report for 7, 30 or 90 days. A link can be revoked in the console. The share page has no sign-in requirement and excludes owner identity, wallet URL, test-player ID and credentials; it includes technical transaction IDs, values, proof hashes and assertion results. Share only with intended reviewers. The secret is in the URL fragment rather than a query parameter, and the viewer sends it to the same-origin read API in a header. Only its hash is retained in the database. A new share URL is shown once; another device can create a fresh link and revoke old links. Revoking or expiring a link blocks future reads; it cannot withdraw a copy already saved by a recipient.

| Request | Action |
| --- | --- |
| `GET /api/wallet-lab/reports` | List the current account's stored reports |
| `POST /api/wallet-lab/reports` | Save `{ "run": <terminal browser run> }` as a redacted immutable report |
| `GET /api/wallet-lab/reports/{id}` | Read an account-owned report without executing tests |
| `GET /api/wallet-lab/reports/{id}/shares` | List share-link status and expiry, without returning its secret |
| `POST /api/wallet-lab/reports/{id}/shares` | Create a link with `{ "expiresInDays": 30 }`; 7 and 90 are also supported |
| `POST /api/wallet-lab/reports/{id}/shares/{shareId}/revoke` | Send `{}` to revoke a link; safe to repeat |
| `GET /api/wallet-lab/shared-reports` | Read a valid shared snapshot using `X-Wallet-Report-Token: <fragment token>` |

Account routes require the website's HttpOnly session cookie, never an RGS API key. All mutations require the exact same-origin `Origin` header. Saving and creating links require active Developer Tools access; signed-in account owners can still read their reports and revoke links after their subscription expires. Missing, expired and revoked share capabilities return the same not-found response. Account suspension disables public links. Report/share quotas bound storage and link creation; existing identical saves are retryable without consuming a new-report quota.

## Math and display contract

- 6×5 Cluster Pays; at least five orthogonally connected regular matches, with Wild substitution. No line-pay conversion.
- The calibrated theoretical RTP is 98% in Base, Feature Bet and all three purchased bonus tiers. It is an expectation over the fixed published weighted finite catalogue, not a guarantee for a session and not unrestricted independent reel sampling.
- Natural bonus probability is 1/256 in Base and 5/256 in Feature Bet at a three-times total stake. The conditional tier mix is 253 First / 2 Second / 1 Epic out of 256. Natural and purchased bonuses use the same canonical tier distribution and awards.
- The complete-round cap is 10,000 times the selected base bet. All natural and purchased bonuses receive at least 10 times base bet through an explicit final shortfall top-up, if needed.
- FS retriggers: two add two spins, three add five; maximum three FS on a bonus spin and one FS per reel. The immutable result records the actual played sequence.
- First bonus: Outlaw **Dust & Dynamite** / Dracula **Coffin Awakening**. Marks reset after activation; coin faces start below 1×. Second: **High Noon Heist** / **Blood Moon Ritual**; persistent marks, minimum 1× standard coin. Epic: **Outlaw's Last Stand** / **Eternal Night**; persistent marks, guaranteed converter each spin, standard 2×/5×/10×/20×/50× coin faces.
- Multipliers range from 2× to 100× and act on orthogonally adjacent coins and pots; they do not pay independently. Pots and coins can appear in Base and Bonus play. Use each final money cell's `value` as its actual credited EUR amount. `faceBaseValue` and pool values explain the feature before ceilings; they are not extra cash awards.
- Cent settlement and the 10,000× cap are already applied. Never apply a second multiplier, round every individual fractional source independently, add a displayed pool again, or credit a full round after already crediting its event ledger.
- Public math: `/game-math.js`, `/game-catalogue-data.json`; authenticated specification: `/api/v1/math`.

## Errors

Errors use `{ "error": { "code": "…", "message": "…" }, "environment": "sandbox" }`.

| HTTP | Codes / action |
| --- | --- |
| 400 | `INVALID_JSON`, `UNSUPPORTED_FIELD`, `INVALID_GAME`, `INVALID_STAKE`, `INVALID_PAGINATION`, `IDEMPOTENCY_KEY_REQUIRED`; correct the request |
| 401 | `UNAUTHORIZED`, `INVALID_LAUNCH`; authenticate or issue a fresh launch |
| 403 | `ORIGIN_DENIED`; use your backend or the same-origin browser adapter |
| 404 | `NOT_FOUND`; unavailable ownership and unknown IDs share this response |
| 405 | `METHOD_NOT_ALLOWED`; inspect `Allow` |
| 409 | `IDEMPOTENCY_CONFLICT`, `INSUFFICIENT_FUNDS`; never reinterpret either as a settled new wager |
| 410 | `SESSION_CLOSED`; create another evaluation session; prior settled retries remain safe |
| 413 / 415 | `PAYLOAD_TOO_LARGE` / `UNSUPPORTED_CONTENT_TYPE`; JSON bodies are limited to 8,192 bytes |
| 422 | `EVALUATION_ONLY`; no live-money or alternative-currency mode exists |
| 429 | `RATE_LIMITED`; respect `Retry-After`, retaining the same wager key |
| 503 | `GAME_UNAVAILABLE`, `SERVICE_UNAVAILABLE`; retain the wager key and reconcile before resubmitting with a different key |

## Required before a real-money launch

The evaluation core is working integration groundwork. Production approval remains a separate delivery gate. The following are not implemented or verified by this contract:

1. The partner's current, approved integration pack, staging credentials, wallet endpoints, authentication/signature rules, launch/session semantics, supported currencies and certified game identifiers.
2. A partner-specific external-wallet adapter covering debit, credit, transaction status, duplicate callbacks, session expiry, interrupted bonus recovery, rollback/cancel/refund semantics, exactly-once business settlement, retry queues, reconciliation and operator-visible round reports. The adapter is implemented against the partner's approved specification.
3. Acceptance testing against the partner's staging wallet, including delayed, duplicated, rejected, timed-out and out-of-order callbacks, recovery across restarts and commercial launch sign-off. A local Miniflare test is not partner approval.
4. Independent math/RNG/game testing and any certificates required for the intended market and aggregator; signed release artefacts, controlled game changes and the approved RTP configuration. The current finite-catalogue prototype is explicitly uncertified.
5. Operator agreements, launch jurisdictions, responsible-gaming and limit controls, real-money player/session identity, operator reporting, security review, infrastructure capacity testing, monitoring/on-call coverage, incident response, backup/restore drills and retention policy.

The user-supplied company and licence details on the website do not automatically certify these game builds or this new RGS. Static Riot can provide the evaluation package and publishable math for review; live operation must remain disabled until its actual launch gates are complete.

## Verification

Run `node scripts/integration-api-check.mjs` against the repository. It bundles the actual Worker and applies migrations to an isolated Miniflare D1 database. The checks cover both games' engine parity and exact cent receipts, idempotent retry and conflicts, concurrent settlement, ownership, stake validation, no automatic refill, replay/history/reconciliation, immutable ledger enforcement, one-use launches, session-bound cookies and key revocation. No live account, customer payment or casino wallet is touched.

Run `node scripts/integration-contract-check.mjs` to execute the shipped Node example for both games/all five modes against that actual Worker in a disposable database. It injects a lost response after a committed wager, checks restart/resume after session closure without extra rounds, validates HTTP responses against the public OpenAPI schemas and executes the shipped Postman requests/scripts for both games. This verifies the downloadable tools themselves, including their request templates and retry guards.

The downloadable `integration-example.mjs` is a dependency-free Node 22+ HTTP runner. Set `SR_API_KEY` privately and run it to exercise both games and all five modes. It writes request IDs to `.static-riot-integration-state.json` **before** mutations, automatically retries transient failures with the same keys, verifies exact duplicate/replay/keyed responses and SHA-256 result hashes, exports paginated receipts, reconciles and closes both sessions. Re-running the same journal verifies/reuses those settled rounds rather than spending again. Keep only one process on a journal at a time. Choose a new `SR_STATE_FILE` to start a separate evaluation; do not discard unresolved requests. `SR_GAMES=outlaw` / `dracula`, `SR_MODES=base,hunt` and `SR_API_BASE` can select a smaller run or local staging service. Never put an API key in a command argument or a public file.

The Postman collection uses local/environment `apiKey` and collection `game`, `mode`, `betCents`, `createKey` and `roundKey` variables. Its pre-request scripts retain keys and reject a changed request body for an existing key. Follow the collection instructions to start a new wager/session. Both tools evaluate existing developer access; they do not subscribe, charge a card or activate a commercial licence.
