Skip to main content

Webhook verification

When a transaction occurs, Tingee sends a Webhook (IPN) to the partner's endpoint. The SDK provides the verifyWebhookSignature() method to verify the signature simply and securely.

Why verify?

The x-signature header ensures the request comes from Tingee and not from a third party impersonating it. Always verify before processing the transaction.


Usage​

import express from 'express';
import { TingeeClient, isErrorResponse } from '@tingee/sdk-node';

const client = new TingeeClient({
secretKey: process.env.TINGEE_SECRET_KEY!,
clientId: process.env.TINGEE_CLIENT_ID!,
});

app.post('/webhook/tingee', express.json(), (req, res) => {
const result = client.verifyWebhookSignature(
req.headers['x-signature'] as string,
req.headers['x-request-timestamp'] as string,
req.body,
);

if (isErrorResponse(result)) {
return res.status(401).json({ error: result.message });
}

// ✓ Valid signature — process the transaction
const { transactionCode, amount } = req.body;
// Update the order...

res.json({ received: true });
});

Tingee retry policy​

If the partner's endpoint does not respond within 10 seconds (timeout), Tingee automatically resends the webhook.

Idempotency

Always use transactionId or orderId to check whether the order has already been processed, to avoid duplicates when you receive a retry.


See also​