Verify Toss Payments webhooks: v1 base64
Toss Payments signs body:transmission-time with HMAC-SHA256, base64-encodes it, and sends one or more v1: values.
Header set
| Header | Meaning |
|---|---|
| tosspayments-webhook-transmission-time | send time (ISO 8601) |
| tosspayments-webhook-transmission-id | delivery id (not for deduplication) |
| tosspayments-webhook-transmission-retried-count | number of retries |
| tosspayments-webhook-signature | v1:<base64>, comma separated |
The signed string is the body followed by a colon and the send time. The order is the reverse of Stripe, which is the usual trap.
base = raw body + ":" + transmission-time signature = base64(HMAC-SHA256(SECRET, base))
Verification code
const raw = req.body; // Buffer
const ts = req.get("tosspayments-webhook-transmission-time") || "";
const header = req.get("tosspayments-webhook-signature") || "";
const digest = crypto.createHmac("sha256", SECRET)
.update(Buffer.concat([raw, Buffer.from(":" + ts)]))
.digest();
const ok = header.split(",").map(p => p.trim())
.filter(p => p.startsWith("v1:") || p.startsWith("v1="))
.some(p => {
const given = Buffer.from(p.slice(3), "base64");
return given.length === digest.length &&
crypto.timingSafeEqual(given, digest);
});
const fresh = Math.abs(Date.now() - Date.parse(ts)) <= 300 * 1000;
if (!ok || !fresh) return res.status(401).send("invalid");Multiple signatures and key rotation
During a key change Toss Payments sends signatures made with both the old and new key. Accept the request if any one matches so payment notifications keep flowing. The header can grow past common limits, so allow at least 1 KB per header at the firewall.
The signature is not enough
The signature only proves the request came from Toss Payments. Do not ship goods based on the amount and status in the body; confirm orderId, totalAmount and status through the payment lookup API. Requests older than five minutes should not be processed.
- Verify the signature and the transmission time.
- Deduplicate with eventId.
- Re-check amount and status through the payment lookup API.
- Respond 200 within ten seconds and process asynchronously.
Enter the transmission time and verify the v1 signature yourself.
Open the signature verifierFrequently asked questions
Why does the signature header keep changing length?
Each additional signature adds about 48 characters. Do not hard-code the format; handle every v1: entry.
Can transmission-id be used for deduplication?
No. It is new for every delivery, so it cannot detect retries. Use eventId from the body.
Are test payments signed the same way?
Yes. Only the key differs between test and live environments. Confirm which key you are using.
This guide follows the signing schemes published by GitHub, Stripe, Slack, Shopify and Toss Payments.
← Guides