Integrations

Webhooks Overview

Set up webhooks to receive real-time notifications about key events like payments, refunds, and subscriptions.

Webhooks allow your platform to communicate automatically with other applications in real time. By sending HTTP requests to a specified URL when certain events occur, webhooks enable seamless integration, automation, and data synchronization between systems.

What Are Webhooks?

A webhook is essentially an HTTP callback triggered by events such as a new subscription, failed payment, or refunded transaction. Unlike polling APIs, webhooks push data immediately, reducing latency and system load.

Example Use Cases:

  • Notify your CRM when a customer upgrades their subscription.

  • Trigger an email notification after a failed payment.

  • Sync orders with an accounting system.

Key Events Triggering Webhooks

Common events that fintech SaaS platforms typically support include:

Event Type

Description

subscription.created

A new subscription is started

subscription.updated

A subscription is changed or upgraded

subscription.canceled

A subscription is canceled

payment.succeeded

A payment is successfully processed

payment.failed

A payment attempt fails

refund.initiated

A refund is requested or processed

customer.updated

Customer details are modified

Setting Up Webhooks

  1. Create a Webhook Endpoint

    A URL on your server that can receive HTTP POST requests. Example in Node.js:

typescript

const express = require('express');
const bodyParser = require('body-parser');

const app = express();
app.use(bodyParser.json());

app.post('/webhooks', (req, res) => {
    console.log('Webhook received:', req.body);
    // Process event here
    res.status(200).send('Received');
});

app.listen(3000, () => console.log('Server listening on port 3000'));

typescript

const express = require('express');
const bodyParser = require('body-parser');

const app = express();
app.use(bodyParser.json());

app.post('/webhooks', (req, res) => {
    console.log('Webhook received:', req.body);
    // Process event here
    res.status(200).send('Received');
});

app.listen(3000, () => console.log('Server listening on port 3000'));

typescript

const express = require('express');
const bodyParser = require('body-parser');

const app = express();
app.use(bodyParser.json());

app.post('/webhooks', (req, res) => {
    console.log('Webhook received:', req.body);
    // Process event here
    res.status(200).send('Received');
});

app.listen(3000, () => console.log('Server listening on port 3000'));
  1. Register the Webhook in Your Dashboard

    • Go to the Webhooks section of your platform.

    • Add your endpoint URL and select which events to subscribe to.


  2. Verify and Secure

    • Validate that incoming requests originate from your platform.

    • Use secret tokens or signatures to ensure data integrity.

typescript

// Example: Verify webhook signature
function verifySignature(payload, signature, secret) {
    const crypto = require('crypto');
    const expectedSignature = crypto.createHmac('sha256', secret).update(payload).digest('hex');
    return expectedSignature === signature;
}

typescript

// Example: Verify webhook signature
function verifySignature(payload, signature, secret) {
    const crypto = require('crypto');
    const expectedSignature = crypto.createHmac('sha256', secret).update(payload).digest('hex');
    return expectedSignature === signature;
}

typescript

// Example: Verify webhook signature
function verifySignature(payload, signature, secret) {
    const crypto = require('crypto');
    const expectedSignature = crypto.createHmac('sha256', secret).update(payload).digest('hex');
    return expectedSignature === signature;
}

Best Practices for Webhooks

  • Retry Mechanism: Ensure your endpoint can handle retries in case of temporary failures.

  • Idempotency: Design your webhook handler so processing the same event multiple times does not cause duplicate actions.

  • Logging: Keep logs of all received webhook events for debugging and auditing.

  • Security: Always verify the signature of incoming requests and use HTTPS endpoints.

Webhooks are a powerful tool for automation and real-time integrations. Correct implementation ensures seamless communication between your platform and external systems.

Need help? Contact Support

Questions? Contact Sales

On this page

Navigate

Select

New tab

Esc

Close

Navigate

Select

New tab

Esc

Close

Create a free website with Framer, the website builder loved by startups, designers and agencies.