Skip to content

You check: our verifier server

Documents @snap4id-sdk/purchase-verifier 1.0.0

You check purchases on your own infrastructure without writing code: deploy our ready-made verifier server and configure it. It runs exactly the checks Snap4ID’s own verifier runs, with your store details and your key. The Snap4ID page sends each receipt to your server. Your server validates it, then sends Snap4ID an unlock request for the job’s payment ref, signed with your Ed25519 key: that signature, not the receipt, is what Snap4ID trusts. If you would rather check receipts inside your existing backend, see You check: your own backend.

Snap4ID checks purchases You check: our verifier server
Where the page sends the receipt https://snap4.id/verifier https://<your host>/verifier
Your store details sent to Snap4ID configuration files on your server
Signs the unlock request the verifier, with a key Snap4ID holds for your partner id your server, with your Ed25519 key (public half registered with Snap4ID)
Page authentication App Check (Snap4ID) App Check against Snap4ID’s project, or your own hook

Your app is set up exactly as when Snap4ID checks (no onVerifyPurchase; a native host sends the receipt in purchase.result): only the address the page sends it to changes. The receipt is still never checked in the app.

The server is in the SDK repository under examples/purchase-verifier-self-host (package.json, server.mjs, Dockerfile), built on createReceiptHandler from @snap4id-sdk/purchase-verifier. Node 22:

Terminal window
npm install # @snap4id-sdk/purchase-verifier and firebase-admin from npm
export PURCHASE_VERIFIER_PARTNERS_DIR=/secrets/partners
export PURCHASE_VERIFIER_API_BASE_URL=https://snap4.id
export PURCHASE_VERIFIER_ALLOWED_ORIGINS=https://snap4.id
export PURCHASE_VERIFIER_APP_CHECK_PROJECT_ID=<given by Snap4ID>
node server.mjs # PORT, default 8080
curl -s localhost:8080/v1/health # {"status":"ok","deployment":"production"}

On a container platform: build the Dockerfile, mount the partner directory from your secret store at /secrets/partners, allow unauthenticated invocation (the verifier authenticates the page itself), terminate TLS in front. PURCHASE_VERIFIER_DEPLOYMENT=production is the default; test (with PURCHASE_VERIFIER_ACCEPT_TEST_RECEIPTS=true) also accepts fake receipts and is for development only.

Per partner id in PURCHASE_VERIFIER_PARTNERS_DIR: <partner_id>.config.json (your store details, format) and <partner_id>.key.json ({ "key_id", "private_key_pem" }, mode 0600). Files are re-read about once a minute, and immediately after Snap4ID rejects the key, so rotation needs no restart.

  • Keep retired product ids for 30 days: a retry of an already unlocked purchase is verified first.
  • Sandbox in production is refused unless sandbox_in_prod_until is a future date (App Review); xcode and test are always refused in production.
Terminal window
openssl genpkey -algorithm ed25519 -out verifier.pem
openssl pkey -in verifier.pem -pubout -out verifier.pub.pem

Send verifier.pub.pem to Snap4ID; you get a key_id. The private key never leaves your host and is never logged.

  • PURCHASE_VERIFIER_ALLOWED_ORIGINS lists the page origins exactly; no wildcard, no credentials.
  • The default authentication verifies the X-Firebase-AppCheck token against Snap4ID’s project (application default credentials). For your own scheme, createSelfHostedServer(env, { authenticate }): the hook gets { method, path, headers } and returns { ok: true } or { ok: false, code: 'app_check_failed' }.

Tell Snap4ID your server’s public URL; your partner configuration’s verifier URL becomes https://<your host>/verifier (the server answers both /v1/… and /verifier/v1/…). Check with a test purchase: the job unlocks. HTTP API: purchase verifier reference.