The signed request
Every request includes:HMAC-SHA256(secret, timestamp + "." + JSON payload), using a Unix timestamp in milliseconds and lowercase hexadecimal output. Use the complete flk_whsec_... secret string as the key and the exact request bytes, without parsing and reserializing JSON. Verify first, then decode and validate the body. The signed body’s IDs are authoritative; separate ID headers assist diagnostics.
The body and event ID remain unchanged across retries. Each send has a fresh timestamp and signature. Allow at most five minutes of clock difference in either direction and keep your server clock synchronized.
Copy the verifier
The examples accept the current secret and, during rotation, the previous secret. They accept a matchingv1 value, reject malformed headers and oversized bodies, and use constant-time comparisons.
tsc or remove its type annotations. No payment-provider SDK is needed for verification.
Minimal raw-request diagnostic
For a NodeIncomingMessage, read bounded chunks into a Buffer, pass it and the single flokit-signature header to verifyFloKit, and parse JSON only after successful verification. Set request and header timeouts and reject duplicate signature-header fields.
Raw request handling