Skip to main content
Fintoc signs every event sent to your webhook endpoints with the Fintoc-Signature header. Use this header to verify that an event came from Fintoc, not a third party. Fintoc generates a secret when you register a webhook endpoint. Fintoc shows this secret only once. Use the secret to validate each event’s signature.

Verify that events come from Fintoc

Each event sent by Fintoc includes the Fintoc-Signature header. The header contains a Unix timestamp under the t key and a signature under the v1 key:
Fintoc generates each signature as a hash-based message authentication code (HMAC). Fintoc signs the timestamp and raw request body with the webhook endpoint secret and the SHA-256 hash function.

Validate the signature with an SDK

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

Validate the signature with your code

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

Extract the timestamp and signature

Split the Fintoc-Signature header at the , character. Then, split each resulting element at the = character to obtain the key-value pairs. Extract the value for each key.

Rebuild the signed message

Fintoc signs a message composed of the timestamp, a . character, and the raw request body. Rebuild this message with the timestamp from the Fintoc-Signature header and the raw request body.
Use the raw request body directly from the request. Libraries can represent parsed JSON differently. The value of message has the following format:

Generate the signature

Sign the message with the SHA-256 hash function and the secret generated when you created the webhook endpoint.

Compare the signatures

Compare the signature from the Fintoc-Signature header with the signature you generated. If the signatures match, you can confirm that Fintoc sent the event.

Prevent replay attacks

To prevent replay attacks, define a tolerance range for event delivery delays. When you receive an event, verify that its timestamp falls within this range. Discard the event if its timestamp falls outside the range.