Sandbox guide
After this page you can test your integration in the sandbox: play against the wallet simulator, force results, check your wallet with the conformance runner and read the request log.
The sandbox uses test money only. It runs the same game server code as production, with these sandbox-only tools switched on. None of them exist in production.
#Wallet simulator
Until you give Reelbit your own wallet URL, your sandbox account points at Reelbit's wallet simulator. It follows the wallet contract exactly, so you can play and test before your wallet exists. Any player_id you use starts with 500.00 SC and 100,000.00 GC of test money.
#Set up a test player
PUT /v1/sandbox/players/{player_id} sets a simulator player's balance, failure switch and forced next result. It is signed like any other call. Send only what you want to change; null clears a switch.
{ "currency": "SC", "balance": 2500, "failure": null, "force_next": "max_win" }GET /v1/sandbox/players/{player_id}?currency=SC reads the player back.
#Failure switches
A failure switch makes the simulator misbehave for that player, so you can watch how Reelbit and your page handle it.
failure | What the simulator does |
|---|---|
slow | Answers after 6 seconds, beyond Reelbit's 5-second limit. The debit is rolled back. |
http_500 | Answers 500 without doing anything. The debit is rolled back; credits are retried. |
http_502 | Answers 502 without doing anything. |
drop | Closes the connection without answering. |
insufficient | Refuses every debit with INSUFFICIENT_FUNDS. |
twice | Processes every call twice, as if the network delivered it twice. |
#Forced results
force_next decides the category of that player's next round, so you can test how your platform handles each kind of result. It clears itself after one round. It works whether your sandbox account uses the simulator or your own wallet.
force_next | Next round |
|---|---|
loss | A round that wins nothing. |
small_win | A small win. |
big_win | A big win. |
max_win | The game's maximum win. |
feature | A round that triggers the game's feature. |
The exact round within the category is still picked by the secure random source, and the round is marked as forced in Reelbit's records. Forced results do not exist in production.
#Conformance runner
The conformance runner checks your wallet against every rule in Wallet integration. Point your sandbox account at your wallet, then:
curl -X POST https://api.sandbox.reelbit.io/v1/sandbox/conformance \
-H 'content-type: application/json' \
-H "X-Reelbit-Key-Id: $KEY_ID" -H "X-Reelbit-Timestamp: $TS" -H "X-Reelbit-Signature: $SIG" \
-d '{"player_id":"conformance-player","currency":"SC"}'Sign it like any call (the quick start script shows how). Optional fields: player_id (default conformance-player), currency, amount in minor units (default: your smallest play amount), skip_slow (leave out the 6-second test) and wallet_base_url (test a different public https address for this run).
The runner signs its calls with your outbound key, as Reelbit does. The test player needs a balance of at least 150 times the play amount, because one scenario buys a feature at 100 times the play. It runs these scenarios and reports, for each, the request sent, the response received, what was expected and whether it passed:
- Balance.
- Debit then credit.
- Losing round (credit of 0).
- Feature purchase (one debit for the play times the cost multiplier).
- Duplicate debit.
- Duplicate credit.
- Duplicate with a different amount (
409 DUPLICATE_TRANSACTION_MISMATCH). - Rollback of a known debit.
- Rollback of an unknown debit.
- Debit arriving after its rollback (
409 ROUND_ROLLED_BACK). - Credit after rollback (
409 ROUND_ROLLED_BACK). - Insufficient funds (
402 INSUFFICIENT_FUNDS). - Credit after the session has expired.
- Invalid signature (
401 INVALID_SIGNATURE). - Stale timestamp (
401 TIMESTAMP_OUT_OF_RANGE). - Unsupported currency (
422 CURRENCY_NOT_SUPPORTED). - Zero and negative amounts (
422 INVALID_AMOUNT). - 20 concurrent debits for one player, each taken exactly once.
- Slow response (over 5 seconds): the debit is rolled back and refunded.
- 500 response: the debit is rolled back and refunded.
Your wallet cannot be told to answer slowly or with a 500, so scenarios 19 and 20 check the part that is yours: that a rollback refunds the debit. Against the simulator they use its failure switches. Every scenario must pass before go-live.
#Request log
The request log shows your last 500 requests in each direction: calls you made to Reelbit, and calls Reelbit made to your wallet. Each entry has the headers, body, response, timing and the result of the signature check. Signatures and secrets are shown as (redacted). Calls refused for a bad signature are logged too, with the reason.
- In a browser:
https://api.sandbox.reelbit.io/sandbox/request-log. Sign in with your inbound key id as the user name and your inbound secret as the password. - As JSON:
GET /v1/sandbox/request-log, signed. Add?direction=inboundor?direction=outboundfor one direction.
You only ever see your own requests.
Docs