Integration guide
Server events and outbox
Verify actions on your server and deliver one durable event decision.
9ae5180d5f8f.Verify first, then record one event
Record a server-verified rewarded-play event. A server secret authenticates this integration; it cannot prove a claim from a compromised game server. Use your own authenticated account mapping and authoritative game state before creating the event.
Persist the verified game action and its serialized event body atomically in your durable outbox. Generate one event UUID and UTC timestamp when recording the action. Do not accept device-selected player UUIDs or caller-supplied payout fields.
import { createGameServerClient, recordVerifiedEvent } from './game-server.mjs';
const client = createGameServerClient({
origin: 'https://api.ggbucks.com',
secretKey: process.env.GGBUCKS_GAME_SECRET_KEY,
});
const body = recordVerifiedEvent(serverMappedPlayerId, 'level_completed', { level: 4 });
// Persist body atomically with the verified action BEFORE delivery.
// A bounded worker later calls client.sendRecordedEvent(thePersistedBody).Respect current limits and immutable decisions
Clock skew allowance is 300 seconds. Fresh event rate is 120 per game per minute. Metadata is bounded to 4096 UTF-8 bytes, depth 6, 100 array items and 100 object entries. Synchronize the game server clock.
Replay the same ID and the same body after an unknown outcome. Changing player, type, timestamp or metadata for that ID is a conflict. Rejected decisions are immutable too; changing a rule later does not change the original result. Retry only transport errors, 429 and 5xx with a finite budget/backoff; retain exhausted jobs for operator review. Other 4xx failures need correction rather than automatic retries.
A successful HTTP request can still be rejected
Record status, reason and replayed from every event response. A 2xx response with rejected status earns no allowance; an accepted replay never creates a second grant. These decisions affect sandbox TEST accounting only, with no cash value or production-wallet credit. Project/game budgets, payout ceilings and daily player caps remain enforced server-side.
Use the same contract in your project
Read the focused agent skill or download its source and contract ZIP. Review the included source before adding it to your game. Exact fields and action variants are available in the API reference.