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.
Run it
Section titled “Run it”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:
npm install # @snap4id-sdk/purchase-verifier and firebase-admin from npmexport PURCHASE_VERIFIER_PARTNERS_DIR=/secrets/partnersexport PURCHASE_VERIFIER_API_BASE_URL=https://snap4.idexport PURCHASE_VERIFIER_ALLOWED_ORIGINS=https://snap4.idexport PURCHASE_VERIFIER_APP_CHECK_PROJECT_ID=<given by Snap4ID>node server.mjs # PORT, default 8080curl -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.
Configuration files
Section titled “Configuration files”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_untilis a future date (App Review);xcodeandtestare always refused in production.
The unlock key
Section titled “The unlock key”openssl genpkey -algorithm ed25519 -out verifier.pemopenssl pkey -in verifier.pem -pubout -out verifier.pub.pemSend verifier.pub.pem to Snap4ID; you get a key_id. The private key never leaves your host and is never logged.
CORS and authentication
Section titled “CORS and authentication”PURCHASE_VERIFIER_ALLOWED_ORIGINSlists the page origins exactly; no wildcard, no credentials.- The default authentication verifies the
X-Firebase-AppChecktoken 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' }.
Point Snap4ID at it
Section titled “Point Snap4ID at it”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.
