Skip to main content
@gamavas/pass-server is for your game’s server. It has no dependencies, using only fetch and Web Crypto, so it runs on Node 20+, Bun, Deno and Cloudflare Workers. It ships as ESM and CommonJS, with types.
The package is on its way to npm. Until it’s there, call the HTTP API directly: it’s the same three calls.

Set up

Create a secret key on your app’s Keys page in the developer portal. Keep it on your server: Gamavas refuses secret keys sent from a browser.
A test key (gmv_sk_test_…) sees only test purchases (gamavas.testMode is true), and a live key only real ones.

Verify a player

Don’t trust a player ID your game sends. Have your game send its access token instead, and ask Gamavas who it belongs to:
Only live tokens issued to your game are accepted; anything else throws unauthorized. How to get the token in each engine is on Your server.

Ownership

Unlock achievements

Including those marked server in the portal, which a game can’t unlock itself:

Verify webhooks

Pass the raw request body, not parsed JSON:
event is typed by event.type: order.paid, order.refunded, entitlement.revoked, achievement.unlocked or webhook.test. verifyWebhook throws invalid_signature if the signature is wrong or more than 5 minutes old (set toleranceSeconds to change that).

Errors

Every failure throws a GamavasPassError with a code, Gamavas’s message and, when Gamavas answered, the HTTP status:

Options