Test your backend
Documents @snap4id-sdk/partner-api 1.0.0 · @snap4id-sdk/purchase-verifier 1.0.0 · @snap4id-sdk/embed-protocol 1.0.0 · protocol 1.0
For when you check purchases: in your own backend (or on our verifier server).
- Webhook receiver.
@snap4id-sdk/embed-protocol/nodehas the webhook signing helpers and test keys; sign a fixture body and check your receiver accepts it, rejects a tampered body with401, and answers a repeatedevent_idwith2xxand no side effect. - Signing vectors. The SDK repository’s
contracts/holds signing test vectors for Partner API requests and webhooks: run them against any signing code of your own. - Receipts.
verifyReceiptwithpolicy: { deployment: 'test', acceptTestReceipts: true }accepts the fake store’s receipts, so your endpoint can be tested end to end without a store. Production code keepsdeployment: 'production', acceptTestReceipts: false. - End to end. The SDK’s fake Snap4ID page with partner
test-backend: your app sends receipts to your backend, your backend unlocks through the page’s Partner API (base URLhttp://127.0.0.1:8090, signed with the test partner key the page writes to.local/test-keys/partner.ed25519.private.pemin the SDK checkout, key id in.local/test-keys/key-ids.json), and the page sends signedjob.paidwebhooks toFAKE_SNAP4ID_WEBHOOK_URL. The SDK’sexamples/partner-backendruns this way out of the box (its README).
Cases worth a test: unlock success, a repeated unlock (idempotent, same answer), already_paid recorded as a refund,
a retryable failure that keeps the purchase pending, and recovery unlocking it later.
