Buying an item for real value is the highest-stakes flow in the platform. It
is SDK-mediated by design: the SDK owns the environment pre-flight, the
bearer authentication, the backend paths, and the response parsing. Your game
only provides business data.
Never hand-roll a purchase. Route all purchases through the SDK’s PurchaseClient — the SDK core is the only place that knows the purchase endpoint paths.
The flow
Mint a PIN session
The on-device integrity check classifies risks:
- critical risks (
DEVICE_ROOTED, DEBUGGER_ATTACHED) → COMPROMISED,
- any other risk (screen capture, suspicious accessibility, …) →
WARN,
- no risks → the raw integrity level (
SAFE by default).
Any detected risk blocks the purchase client-side and reports
ENV_COMPROMISED to /api/v1/security/events.
Verify the PIN
The amount travels as a decimal string on the wire; always provide a
fresh idempotencyKey per authorized withdrawal.
Security events
Best-effort audit logging (backend acknowledges with 202). The SDK reports
automatic pre-flight blocks; use it for your own incidents:
Wallet custody boundary
The SDK never sees, holds, or signs wallet private keys. Custody lives in
MusterBox’s MPC custody layer; the player authorizes a withdrawal by PIN, and
the custody layer executes it. The destinationAddress your code passes to
verify is the single authorization target — validate it carefully.
Next: Security & integrity.