Secure webhook verification examples for XPayr, including raw-body HMAC validation, idempotency, retries, and durable processing patterns.
Status: Public reference implementation
Help backend teams process XPayr events safely across common server runtimes.
- Node.js, PHP, and Python verification examples
- Shared deterministic signature fixtures
- Idempotent event-processing guidance
npm install
npm test- Read the HTTP request body as untouched bytes. Do not parse or re-serialize it first.
- Verify
X-XPayr-Signaturewith HMAC-SHA256 and your webhook secret. - Require a stable event ID and enforce uniqueness in durable storage.
- Persist the event and the payment-state transition in one transaction.
- Return
2xxonly after durable processing; retries must produce the same result.
Runnable handlers are available under node/, php/, and python/. The shared fixture ensures all runtimes implement the same signature contract.
Use an XPayr test key before live credentials. Never expose sk_test_*, sk_live_*, agent keys, webhook secrets, or wallet private keys in browser code or commits.
Read SECURITY.md before reporting a vulnerability. Payment completion must be based on verified XPayr webhook/API state and canonical on-chain evidence, not browser callbacks alone.
MIT. See LICENSE.