Authentication
Every request from us carries three headers:
| Header | Meaning |
|---|---|
X-VendStack-Key |
Your API key — a public connection identifier (shown on the dashboard's Merchant API card). Not a secret; use it to tell which of your connections a request is for. |
X-VendStack-Timestamp |
Unix seconds when we signed the request |
X-VendStack-Signature |
HMAC-SHA256 signature (hex) |
Both the API key and the signing secret are on the dashboard: Integrations → Merchant API. You verify requests with the signing secret below — the key is just an identifier.
The signature is computed over this exact string, joined by dots:
{timestamp}.POST.{path}.{rawBody}
where path is the request path (e.g. /vend) and rawBody is the raw JSON body. Recompute it with your signing secret (shown on the dashboard's Merchant API card) and compare — reject the request if it doesn't match or the timestamp is stale (say, older than 5 minutes).
PHP
$expected = hash_hmac('sha256',
$timestamp.'.POST.'.$path.'.'.$rawBody, // e.g. "1753631999.POST./vend.{...}"
$yourSigningSecret
);
if (! hash_equals($expected, $providedSignature)) {
abort(401);
}
Node
const expected = crypto.createHmac('sha256', signingSecret)
.update(`${timestamp}.POST.${path}.${rawBody}`)
.digest('hex');
if (!crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(provided))) return res.sendStatus(401);