Set up your endpoint
- Create an HTTPS endpoint on your server that accepts
POSTrequests. - Email [email protected] with its URL and your partner name.
- We’ll send you a signing secret, starting with
whsec_. You’ll only receive it once, so store it as carefully as an API key.
What Tern sends
Handle a request
- Check the signature, as shown below. If it doesn’t verify, reject the request.
- Respond with any
2xxstatus within 10 seconds. - Do any slow work after responding, or add it to a queue. Requests that take too long are retried.
Check the signature
Use a Standard Webhooks library with your secret and the raw request body, exactly as you received it, before parsing the JSON. It checks the signature and rejects a timestamp more than 5 minutes away from now, which stops anyone who captures a request from replaying it later.v1, followed by the base64 HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{body}, keyed by the secret’s bytes: the base64 after whsec_, decoded. Compare it in constant time with each signature in the header.
Delivery and retries
- You may get the same update twice. Tern keeps retrying until you respond with
2xx. Ignore repeats by theirwebhook-id. - Updates arrive in order for each swap. A later update waits while an earlier one is being retried. Different swaps don’t wait for each other.
- What counts as a failure: any status other than
2xx, no response within 10 seconds, or a redirect. - When Tern retries: 10 seconds after a failure, then doubling each time, up to an hour apart. After 15 attempts, about 6.5 hours, the delivery is marked as failed. Once your endpoint is back up, email [email protected] and we’ll resend failed deliveries.
- Changing your URL takes effect from the next attempt.
- Rotating your secret: for 24 hours after we rotate it, each request carries two signatures, one per secret, so either one verifies. Switch your endpoint to the new secret within that time.