Integration Docs
Everything you need to embed Solex games into your casino platform — Prediction Markets and TraderHero.
Interactive REST API reference.
Live Prediction Markets demo.
Live TraderHero jackpot demo.
The fastest path to a working integration: register a partner, drop an iframe on your page, send and receive a few postMessages, done. No SDK, no library, no build step — just window.postMessage and window.addEventListener('message'). The host page owns the player’s wallet and authorizes each bet over postMessage. For the live version see the /demo page — that page’s React source is exactly what this guide walks through, condensed into framework-free HTML/JS.
1. Register your partner
One-time call from any shell with curl. Replace <ADMIN_KEY> with the admin key your Solex contact issued.
curl -sS -X POST https://api.solex.games/api/v1/casino/auth/register \
-H 'X-Admin-Key: <ADMIN_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"name": "Acme Casino",
"integrationMode": "custom",
"feePercent": 1.0,
"winFeePercent": 0,
"maxBetAmount": 1000,
"defaultCurrency": "USD"
}'The response contains id (your casinoId), apiKey (ck_…, ships in the client bundle), and apiSecret (cs_…, server-only). The secret is only returned once — save it immediately.
2. Drop the iframe on your page
Add this anywhere you want prediction markets to appear. The page must be served over HTTPS — postMessage origin checks fail on plain HTTP.
<iframe id="solx-iframe"
src="https://embed.solex.games/embed/"
style="width:100%;height:600px;border:none;"
allow="clipboard-read; clipboard-write"></iframe>That’s the entire iframe setup. No SDK script tag, no library to vendor. The integration is the postMessage handlers in step 3.
3. Wire the postMessage handlers
The host page owns the wallet. The flow is:
- Iframe sends
SOLX_READYwhen it boots. - You reply with
CASINO_INIT(partner id, apiKey, user, balance). - Iframe sends
SOLX_BET_REQUESTwhen the user confirms a bet. - You debit the local balance and reply with
CASINO_BET_RESPONSE(authorized: true). - Iframe places the bet via the API and sends
SOLX_BET_CONFIRMED(orSOLX_BET_FAILEDif it rejects, then refund). - On payout, iframe sends
SOLX_PAYOUT_DUE— you credit the balance.
Drop this script after the iframe tag. It’s the same logic as the /demo page, just in plain JS:
<script>
const iframe = document.getElementById('solx-iframe');
let balance = 1500.00; // your real balance lookup goes here
// Helper: send a CASINO_* message into the iframe.
function sendToIframe(type, payload, requestId) {
iframe.contentWindow.postMessage(
{ type, version: '1.0', timestamp: Date.now(), requestId, payload },
'*' // for production, replace with 'https://embed.solex.games'
);
}
// Send the initial CASINO_INIT after the iframe says it's ready.
function sendInit() {
sendToIframe('CASINO_INIT', {
casinoId: '<id from step 1>',
apiKey: '<ck_... apiKey from step 1>',
user: { id: 'player_12345', displayName: 'Player One' },
balance: {
available: balance, reserved: 0,
currency: 'USD', currencySymbol: '$',
},
theme: { mode: 'dark' },
config: { showMyBets: true },
});
}
// Helper: push balance changes so the iframe UI stays in sync.
function pushBalance() {
sendToIframe('CASINO_BALANCE_UPDATE', {
balance: {
available: balance, reserved: 0,
currency: 'USD', currencySymbol: '$',
},
});
}
// Listen for SOLX_* messages from the iframe.
window.addEventListener('message', (event) => {
// For production, also check event.origin === 'https://embed.solex.games'
const data = event.data;
if (!data || data.version !== '1.0') return;
// 1) Iframe ready -> send CASINO_INIT.
if (data.type === 'SOLX_READY') {
sendInit();
return;
}
// 2) Bet authorization.
if (data.type === 'SOLX_BET_REQUEST') {
const amount = Number(data.payload.amount);
if (amount > balance) {
sendToIframe('CASINO_BET_RESPONSE',
{ authorized: false, rejectionReason: 'Insufficient balance' },
data.requestId);
return;
}
balance -= amount; // 1) debit first
sendToIframe('CASINO_BET_RESPONSE', {
authorized: true,
transactionId: 'tx-' + crypto.randomUUID(),
newBalance: { available: balance, reserved: 0 },
}, data.requestId);
pushBalance();
return;
}
// 3) Bet failed AFTER you approved -> refund.
if (data.type === 'SOLX_BET_FAILED') {
const amount = Number(data.payload.amount || 0);
if (amount > 0) { balance += amount; pushBalance(); }
return;
}
// 4) Market resolved -> credit winnings.
if (data.type === 'SOLX_PAYOUT_DUE') {
const amount = Number(data.payload.amount || 0);
if (amount > 0) { balance += amount; pushBalance(); }
return;
}
});
</script>4. Smoke test
Open your page in a browser, click any market in the iframe, place a bet. In DevTools Network tab you’ll see the iframe POST https://api.solex.games/api/v1/casino/bets/place. In DevTools Console (if you console.log inside your message handler) the order should be:
SOLX_READY(iframe bootstrapped)SOLX_BET_REQUEST(user confirmed a bet)SOLX_BET_CONFIRMEDwithin a few hundred ms (with the sametransactionIdyou sent inCASINO_BET_RESPONSE)
For the wire-level CORS preflight checks that prove the split-origin topology is wired correctly, see §9 of the full partner onboarding guide.
Configure your partner (self-service)
Once registered, manage your config via /api/v1/casino/partner/* using your X-Casino-Key header. Read or update any of the 22 partner fields, set commission rates, and approve which markets appear in your catalog.
# Read your config (all 22 fields)
curl -sS https://api.solex.games/api/v1/casino/partner/config \
-H 'X-Casino-Key: ck_your_api_key'
# Update fees, limits, risk params
curl -sS -X PATCH https://api.solex.games/api/v1/casino/partner/config \
-H 'X-Casino-Key: ck_your_api_key' \
-H 'Content-Type: application/json' \
-d '{ "maxBetAmount": 5000, "cashOutEnabled": true }'
# Approve a market for your catalog
curl -sS -X POST https://api.solex.games/api/v1/casino/partner/markets \
-H 'X-Casino-Key: ck_your_api_key' \
-H 'Content-Type: application/json' \
-d '{ "marketId": "<uuid>", "pricingModel": "lmsr" }'Where to go next
Working /demo page with sandbox balance — click around before you integrate.
Every postMessage type you can send and receive, with payloads.
All HTTP endpoints — bets, markets, partner config, reports.
For partners that already run an IGSP wallet and want server-to-server bet execution. Most integrators should use the postMessage flow above.