Skip to main content
By the end of this guide, you can verify that every webhook event came from Fintoc by checking the Fintoc-Signature header. Fintoc signs every event sent to your webhook endpoints. The Fintoc-Signature header lets you verify that Fintoc, not a third party, sent each event. Fintoc generates a secret when you register a webhook endpoint. You need this secret to validate the Fintoc signature of every event.

Verify that Fintoc sent the event

Each event sent by Fintoc includes the Fintoc-Signature header. The header contains a Unix timestamp in t and a signature in v1. For example:
Each signature is a hash-based message authentication code. Fintoc uses SHA-256 to generate the signature from the raw request body and timestamp. The signature uses your webhook endpoint secret.

Validate the signature with the Fintoc SDKs

If you use Node or Python, verify webhook signatures with the Fintoc Node SDK or Fintoc Python SDK.
For a complete implementation, see the Python webhook example.

Validate the signature with your own code

If you want to write your own implementation or use a different programming language, follow these steps:

Extract the timestamp and the signature

Split the Fintoc-Signature header at each , character. Then, split each array element at the = character to obtain a key-value pair. Get the corresponding value for each key.

Rebuild the signed message

The signed message consists of the timestamp, a . character, and the raw request body. Rebuild the message with the timestamp from the Fintoc-Signature header.
Use the raw, unparsed request body. Libraries can represent parsed JSON differently. For example, message should look like this:

Generate the signature

Generate the signature with SHA-256 and the secret returned when you created the webhook endpoint.

Compare the signatures

Compare the signature from the Fintoc-Signature header with the signature you generated. If both signatures match, the event came from Fintoc.

Prevent a replay attack

To prevent a replay attack, define an acceptable age for events. When you receive an event, compare the timestamp from the Fintoc-Signature header with the current time. Use five minutes as the default tolerance. Accept events within this range, and discard events outside it.

Test the integration

Confirm that signature validation works before you rely on it in production. Trigger a test event for your webhook endpoint from the Fintoc Dashboard, then check how your handler responds:
  • With a valid signature, your handler validates the header and processes the event.
  • With an invalid signature, such as a modified v1 value or the wrong secret, your handler rejects the event and returns 400 Bad Request.