Guessiano Docs Demo Portal →

PartnerDocumentação do DocumentationParceiro

Integrate Guessiano end-to-end. You host nothing of the game: the SDK loads from our CDN and renders into a <canvas> on your site; engine, RNG and matchmaking stay on our backend.Integre o Guessiano de ponta a ponta. Você não hospeda nada do jogo: a SDK carrega do nosso CDN e renderiza num <canvas> no seu site; engine, RNG e matchmaking ficam no nosso backend.

Provably-fair Real-time (WS)Tempo real (WS) Seamless walletSeamless wallet

OverviewVisão geral

LayerCamadaWho hosts itQuem hospeda
Engine, rules, RNG, matchmakingEngine, regras, RNG, matchmakingGuessiano (server-authoritative)
Canvas SDK (@guessiano/sdk)SDK canvas (@guessiano/sdk)Loaded from our CDN / npm; runs on your siteCarregada do nosso CDN / npm; roda no seu site
Partner backendBackend do parceiroYou — sign the handshake and mint the launchTokenVocê — assina o handshake e gera o launchToken
Wallet (seamless mode)Carteira (modo seamless)You — credit/debit from wallet.settlementVocê — credita/debita a partir do wallet.settlement
You receive from the Guessiano team: an apiUrl, an apiKeyId and an hmacSecret (shown once). Manage everything in the partner portal.Você recebe da equipe Guessiano: um apiUrl, um apiKeyId e um hmacSecret (mostrado uma única vez). Gerencie tudo no portal do parceiro.

Quickstart (5 min)Quickstart (5 min)

Paste into your site (UMD, zero build). Pin the version and validate with the integrity published in /sdk/<version>/manifest.json:Cole no seu site (UMD, zero build). Fixe a versão e valide com o integrity publicado em /sdk/<versão>/manifest.json:

index.htmlHTML
<div id="guessiano"></div>
<script src="https://cdn.YOUR-DOMAIN.com/sdk/1.0.0/guessiano.umd.js"
        integrity="sha384-…" crossorigin="anonymous"></script>
<script>
  Guessiano.mount('#guessiano', {
    apiUrl: 'https://api.YOUR-DOMAIN.com',
    launchToken: '<token minted by YOUR backend>',
  });
</script>

With a bundler: npm i @guessiano/sdk and import { Guessiano } from '@guessiano/sdk'.Com bundler: npm i @guessiano/sdk e import { Guessiano } from '@guessiano/sdk'.

3-step flowFluxo de 3 passos

1
Your backend signsSeu backend assina

HMAC → POST /v1/sessions with the balance/bet → launchToken (5 min).HMAC → POST /v1/sessions com o saldo/aposta → launchToken (5 min).

2
Your front mountsSeu front monta

Guessiano.mount({ apiUrl, launchToken }). The SDK swaps it for a gameJwt and renders.A SDK troca por gameJwt e renderiza.

3
Wallet settlesWallet liquida

In seamless, you receive wallet.settlement and apply the result.No seamless, você recebe wallet.settlement e aplica o resultado.

Wallet models —Modelos de wallet — internal × seamless

Each tenant uses one model, set by the Guessiano team. You don't change the SDK.Cada tenant usa um modelo, definido pela equipe Guessiano. Você não troca de SDK.

ModelModeloWallet of recordCarteira de registroWhat you doO que você faz
internalGuessianoNo wallet code. We reserve and settle the bet internally.Nada de wallet. Reservamos e liquidamos a aposta internamente.
seamlessYouVocê (in-house casino)(cassino in-house)Send balance + bet at start; receive win/loss at the end and credit/debit in your system.Envia saldo + aposta no início; recebe ganho/perda no fim e credita/debita no seu sistema.

Seamless end-to-endSeamless end-to-end recommendedrecomendado

In seamless mode your system is the wallet of record. Guessiano never holds funds: it only runs the game, keeps the display balance in sync and hands you the result to settle.No modo seamless o seu sistema é a carteira de registro. A Guessiano nunca segura fundos: só roda o jogo, mantém o saldo de exibição sincronizado e te entrega o resultado para liquidar.

1
Start — you send balance + betInício — você envia saldo + aposta

On POST /v1/sessions send balanceCents (the player's current balance) and the bet. We show that balance in the game.No POST /v1/sessions mande balanceCents (saldo atual do jogador) e a aposta. Mostramos esse saldo no jogo.

2
MatchPartida

The game runs on our backend. We don't touch your wallet during the match.O jogo roda no nosso backend. Não tocamos na sua carteira durante a partida.

3
End — we return win/lossFim — retornamos ganho/perda

We emit wallet.settlement. You apply net to the wallet; the screen already shows balanceAfter.Emitimos wallet.settlement. Você aplica net na carteira; a tela já mostra balanceAfter.

The wallet.settlement contractO contrato do wallet.settlement

FieldCampoMeaningSignificado
walletMode"external" in seamless (or "internal")"external" no seamless (ou "internal")
outcome"win" · "loss" · "draw"
stakeamount staked (string, minor units)valor apostado (string, unidade mínima)
payoutgross returned to the player (win: totalPot − rake; draw: stake; loss: 0)bruto retornado ao jogador (vitória: totalPot − rake; empate: stake; derrota: 0)
netdelta to apply to the balancedelta a aplicar no saldo = payout − stake (win: +; loss: −stake; draw: 0)(vitória: +; derrota: −stake; empate: 0)
balanceAfterdisplay balance already updated on screensaldo de exibição já atualizado na tela
currencycurrency (e.g. "BRL")moeda (ex.: "BRL")
Convention:Convenção: the balanceCents you send is the balance before resolving the bet (the stake still "in play"). On loss the balance drops by stake; on win it rises by payout − stake. The SDK updates the screen to balanceAfter; the real transaction is yours.o balanceCents enviado é o saldo antes de resolver a aposta (a stake ainda "em jogo"). Em derrota o saldo cai stake; em vitória sobe payout − stake. A SDK atualiza a tela para balanceAfter; a transação real é sua.

Front: capture the result and settleFront: capture o resultado e liquide

front (browser)JS
const game = await Guessiano.mount('#guessiano', { apiUrl, launchToken });

game.on('wallet.settlement', async (e) => {
  const { walletMode, outcome, stake, payout, net, balanceAfter } = e.payload;
  if (walletMode === 'external') {
    // call YOUR backend to credit/debit the player wallet
    await fetch('/your-backend/settle', {
      method: 'POST',
      body: JSON.stringify({ outcome, net, stake, payout }),
    });
  }
  // the game screen already shows balanceAfter — nothing to do on the front
});
Reliability:Confiabilidade: the event is client-side. For settlement that survives a closed tab, also enable the signed server-to-server webhook — ask the Guessiano team. The front handles UX; the webhook is the source of truth.o evento é client-side. Para liquidação à prova de fechamento de aba, ative também o webhook server-to-server (assinado) — peça à equipe Guessiano. O front cuida da UX; o webhook é a fonte de verdade.

HMAC signingAssinatura HMAC backend

Every server-to-server call is signed with the hmacSecret:Toda chamada server-to-server é assinada com o hmacSecret:

signature
Signature = HMAC-SHA256(hmacSecret,
              timestamp + "\n" + METHOD + "\n" + path + "\n" + sha256(body))

Headers: X-Operator-ID, X-Operator-Timestamp (epoch s), X-Operator-Signature (hex). 60s window, anti-replay.Headers: X-Operator-ID, X-Operator-Timestamp (epoch s), X-Operator-Signature (hex). Janela de 60 s, anti-replay.

node-signer.mjsNode
import { createHash, createHmac } from 'node:crypto';
const ts = Math.floor(Date.now() / 1000);
const path = '/v1/sessions';
const body = JSON.stringify({ externalPlayerId:'user-42', displayName:'Ana', balanceCents:100000 });
const bodyHash = createHash('sha256').update(body).digest('hex');
const msg = `${ts}\nPOST\n${path}\n${bodyHash}`;
const sig = createHmac('sha256', HMAC_SECRET).update(msg).digest('hex');
// headers: X-Operator-ID, X-Operator-Timestamp=ts, X-Operator-Signature=sig
signer.phpPHP
$ts   = time();
$path = '/v1/sessions';
$body = json_encode(['externalPlayerId'=>'user-42','displayName'=>'Ana','balanceCents'=>100000]);
$msg = "$ts\nPOST\n$path\n" . hash('sha256', $body);
$sig = hash_hmac('sha256', $msg, $HMAC_SECRET);
signer.pyPython
import hashlib, hmac, json, time
ts   = int(time.time())
path = '/v1/sessions'
body = json.dumps({'externalPlayerId':'user-42','displayName':'Ana','balanceCents':100000})
msg  = f'{ts}\nPOST\n{path}\n' + hashlib.sha256(body.encode()).hexdigest()
sig  = hmac.new(HMAC_SECRET.encode(), msg.encode(), hashlib.sha256).hexdigest()
The signed body (body) must be byte-identical to the body you send. Full runnable example: examples/partner-integration/ in the repo.O corpo assinado (body) deve ser byte-idêntico ao corpo enviado. Exemplo executável completo: examples/partner-integration/ no repositório.

POST /v1/sessions HMAC

Body { externalPlayerId, displayName, currency?, balanceCents? }{ launchToken, region, expiresInSec: 300, walletMode }. In seamless, balanceCents sets the displayed balance. Call from your backend; deliver the launchToken to your front.Body { externalPlayerId, displayName, currency?, balanceCents? }{ launchToken, region, expiresInSec: 300, walletMode }. No seamless, balanceCents define o saldo exibido. Chame do seu backend; entregue o launchToken ao seu front.

POST /v1/sessions/redeem browser

The SDK does this for you. Body { launchToken }{ gameJwt, refreshToken, playerId, tenantId, displayName, gemBalance, expiresInSec }.A SDK faz isso por você. Body { launchToken }{ gameJwt, refreshToken, playerId, tenantId, displayName, gemBalance, expiresInSec }.

CORS

The SDK calls the API from your domain (cross-origin). Register the origins where the SDK runs in the portal ("Allowed origins" tab) — without this the browser blocks it. Changes apply in ~60s, no redeploy.A SDK chama a API a partir do seu domínio (cross-origin). Cadastre as origens onde a SDK roda no portal (aba "Origens permitidas") — sem isso o navegador bloqueia. As mudanças valem em ~60 s, sem redeploy.

Guessiano.mount(selector, options)

OptionOpçãoTypeTipoDescriptionDescrição
apiUrlstringRequired.Obrigatório. API base URLURL base da API
launchTokenstringToken from your backend (required in prod)Token do seu backend (obrigatório em prod)
locale'pt-BR'|'en-US'|'es-419'|'pt-PT'Initial languageIdioma inicial
colorblindbooleanAccessible palette + shape glyphsPaleta acessível + glifos de forma
onEvent(evt)=>voidReceives all eventsRecebe todos os eventos
onBalanceRequest / onDepositRequestfnOptional wallet hooksHooks opcionais de wallet

Instance: on/off, pause/resume, setLocale, unmount, playerId().Instância: on/off, pause/resume, setLocale, unmount, playerId().

EventsEventos

ready · match.matched · match.started · match.ended · balance.changed · wallet.settlement · navigation.lobby · error.

Guess feedback uses color + shape (accessible):O feedback de palpite usa cor + forma (acessível):

HIGH — guess too highHIGH — palpite alto LOW — guess too lowLOW — palpite baixo HIT — correctHIT — acertou

Distribution & SRIDistribuição & SRI

PathCaminhoUseUso
/sdk/<version>/guessiano.umd.jsProductionProduçãoimmutable, pin the version + integrityimutável, fixe a versão + integrity
/sdk/<version>/manifest.jsonVersion + SRI hashes of each bundleVersão + hashes SRI de cada bundle
/sdk/v1/…Rolling — demos only, never in productionRolling — só para demos, nunca em produção

Formats: guessiano.umd.js (script), .esm.js (bundlers), .cjs.js (Node). SemVer: a breaking change → new major in the path.Formatos: guessiano.umd.js (script), .esm.js (bundlers), .cjs.js (Node). SemVer: breaking change → novo major no caminho.

Self-service portalPortal self-service

At /portal/ you can: view/rotate/create credentials (the hmacSecret appears once), manage CORS origins and track your KPIs. Sign in with the e-mail + temporary password from provisioning.Em /portal/ você: vê/rotaciona/cria credenciais (o hmacSecret aparece uma vez), gerencia as origens CORS e acompanha seus KPIs. Login com o e-mail + senha temporária do provisionamento.

Errors & troubleshootingErros & troubleshooting

ErrorErroCauseCausa
expired_timestampBackend clock outside the 60s windowRelógio do backend fora da janela de 60 s
bad_signatureWrong signature/secret, or signed body ≠ sent bodyAssinatura/secret incorretos, ou body assinado ≠ enviado
replay_detectedSame signature resent within the windowMesma assinatura reenviada na janela
unknown_operatorInvalid X-Operator-ID or revoked credentialX-Operator-ID inválido ou credencial revogada
CORS blocked in the browserCORS bloqueado no browserYour site's origin not registered — see CORSOrigem do seu site não cadastrada — veja CORS

Guessiano · homeinício · portal · provably-fair