Guide #58 Feature Release & Multi-Endpoint Architecture Whitepaper

FamGateway Introduces Multiple Webhook Endpoints: Broadcast Real-Time UPI Payments to Multiple Servers & Bots Simultaneously (Old vs New Architecture Breakdown)

By Aryan Gupta September 5, 2026 5 min read

FamGateway has officially rolled out Multiple Webhook Endpoints & Fan-Out Queue Architecture across all merchant accounts. Developers and digital merchants across India can now broadcast real-time UPI payment notifications to multiple servers, automated Telegram bots, Discord servers, and backup databases simultaneously—eliminating brittle webhook forwarders and single-point-of-failure delays forever.

Executive Architecture Summary:

Prior to this release, merchants were constrained to a single global webhook URL. Today, FamGateway's new fan-out engine introduces normalized multi-endpoint configurations, independent asynchronous queue jobs (webhook_jobs), 1-click Pause/Resume lifecycle controls, granular per-endpoint testing, and enterprise SSRF firewall protection—all while retaining 100% backward compatibility for legacy single-endpoint integrations.


1. The Problem: The Single-Webhook Bottleneck in Modern Tech Stacks

In modern digital commerce, software architectures are rarely monolithic. An Indian merchant selling game top-ups, digital services, WHMCS hosting, or SaaS subscriptions typically manages an integrated multi-service workflow:

  • Primary Storefront: A PHP, Node.js, or WooCommerce website that fulfills customer orders, increments digital balances, or unlocks digital downloads.
  • Telegram / Discord Bot: An instant notification bot that alerts both the merchant and the buyer on Telegram (e.g. bot.send_message()) with order summaries and UTR numbers.
  • Accounting & Disaster Recovery: A secondary analytics backend or cloud log collector that tracks reconciliation metrics independently of the production storefront.

Under a single-webhook architecture (the standard across traditional gateways), sending event notifications to more than one system required merchants to build and maintain a custom webhook forwarder or relay microservice. If that relay script crashed, experienced SSL handshake timeouts, or went down for maintenance, every single downstream service went blind, leading to lost order fulfillments and frustrated customers.


2. In-Depth Comparison: Old vs. New Webhook Architecture

To understand why this architectural upgrade is a game-changer for high-volume merchants, let's examine the exact technical differences between FamGateway's legacy system and the new multi-destination platform:

Architectural Dimension Old Legacy Model New Multi-Endpoint Fan-Out Model
Configurable Endpoints 1 Global URL in user profile Multiple Dedicated Named Endpoints (e.g., Web Store, Telegram Bot)
Multi-Service Broadcasting Not supported natively; required custom relay scripts Native Parallel Fan-Out: dispatches to all active endpoints simultaneously
Failure Isolation If destination timed out, retry loop delayed the entire pipeline Complete Isolation: each endpoint has its own independent row in webhook_jobs
Endpoint Lifecycle Control Must delete URL completely to stop alerts 1-Click Pause / Activate toggle without deleting configurations
Targeted Health Testing Generic test button pinging only primary URL Granular Test & Verify button on each individual endpoint card
Security & Anti-SSRF Defense Basic syntax validation Enterprise SSRF Filtering: Blocks private, loopback (127.0.0.1), and link-local ranges
Delivery Observability Single delivery log stream Granular Logs: Filter by Success/Failed, inspect payload and response per endpoint
Backward Compatibility Standard 100% Seamless: Auto-migrates existing single URLs and syncs users.webhook_url

3. Under the Hood: The Fan-Out Architecture

How does FamGateway deliver webhooks reliably at scale without introducing latency? Here is the exact event-driven pipeline executed during every payment lifecycle:

1
Customer Completes UPI Payment
Buyer scans dynamic QR or taps intent link via PhonePe, Google Pay, Paytm, or FamPay.
2
Bank Settlement Verified
FamGateway's autonomous bank engine matches the 12-digit UTR and order amount, marking the transaction as successful.
3
Active Endpoints Queried & Signed
The system queries all active endpoints from merchant_webhooks and computes a cryptographically signed HMAC-SHA256 signature using your Default API Key.
4
Fan-Out Queue Insertion (webhook_jobs)
An independent delivery job is inserted for each destination (e.g. Primary Store, Telegram Bot, Discord Bot). Each job maintains its own status and retry schedule.
5
Asynchronous Parallel Dispatch & Logging
Workers dispatch HTTP POST requests in parallel. Results, response codes, and bodies are recorded in webhook_logs for real-time inspection.

Because each destination URL is isolated into its own independent queue record, a temporary glitch or server restart on your Telegram bot will never slow down order delivery on your main website. Furthermore, failed deliveries automatically schedule exponential retry attempts up to 5 times.


4. Step-by-Step Guide: Managing Multiple Endpoints

Step 1: Open the Webhook Management Dashboard

Log in to your merchant dashboard and navigate to webhooks.php. You will see the new Active Destinations panel showing all configured endpoints, their operational status (Active vs. Paused), and their creation dates.

Step 2: Add a Secondary Endpoint

Under the Add New Webhook Endpoint form on the right-hand panel:

  1. Endpoint Name / Label: Enter a recognizable label, such as Telegram Store Bot or Backup Database.
  2. Webhook Destination URL: Enter your HTTPS webhook URL (e.g. https://mybot.example.com/api/famgateway-webhook).
  3. Click Add Webhook Endpoint. FamGateway immediately validates the host, runs SSRF security filters, and registers the destination.

Step 3: Test Individual Endpoints with 1-Click Verification

You no longer need to execute live UPI transactions to test your webhook handlers. Each endpoint card features a dedicated Test & Verify button. Clicking this pings that specific endpoint with a signed test payload (is_test: true), displays the remote server's HTTP response in real time, and logs the attempt in your Delivery Logs table.

Step 4: Pausing During Server Maintenance

If you are deploying updates to your Telegram bot or web server, simply click the Pause button on that endpoint. FamGateway will suppress dispatches to that destination while continuing to deliver notifications to all other active endpoints as normal. When your maintenance finishes, click Activate to resume dispatches instantly.


5. Production Code Examples

A. PHP Webhook Receiver (E-Commerce Store)

This script runs on your web server to verify the cryptographic signature and unlock digital orders:

<?php
// webhook.php - Primary Store Webhook Receiver
header('Content-Type: application/json');

$apiKey = "fam_your_default_api_key_here"; // From famgateway.in/api-keys.php
$rawPayload = file_get_contents('php://input');
$signatureHeader = $_SERVER['HTTP_X_FAMGATEWAY_SIGNATURE'] ?? '';

// Step 1: Verify HMAC-SHA256 Signature
$expectedSignature = hash_hmac('sha256', $rawPayload, $apiKey);
if (!hash_equals($expectedSignature, $signatureHeader)) {
    http_response_code(401);
    echo json_encode(['status' => 'error', 'message' => 'Invalid signature verification']);
    exit;
}

// Step 2: Parse Payment Payload
$data = json_decode($rawPayload, true);
if (!$data || ($data['event'] ?? '') !== 'payment.success') {
    http_response_code(400);
    echo json_encode(['status' => 'ignored']);
    exit;
}

$orderId = $data['order_id'];
$amount = $data['amount'];
$utr = $data['utr'];

// Step 3: Fulfill Order in your Database (Idempotent Check)
// fulfillCustomerOrder($orderId, $amount, $utr);

http_response_code(200);
echo json_encode(['status' => 'success', 'order_id' => $orderId]);

B. Python / FastAPI Webhook Receiver (Telegram Bot)

This script runs alongside an automated Telegram bot using the official famgateway Python SDK to notify administrators or customers in real time:

# telegram_webhook.py - FastAPI Telegram Bot Notifier
from fastapi import FastAPI, Request, Header, HTTPException
import hmac
import hashlib
import requests

app = FastAPI()
API_KEY = "fam_your_default_api_key_here"
TELEGRAM_BOT_TOKEN = "your_telegram_bot_token"
ADMIN_CHAT_ID = "123456789"

@app.post("/api/famgateway-bot-hook")
async def handle_famgateway_webhook(
    request: Request,
    x_famgateway_signature: str = Header(None)
):
    # Step 1: Read raw body and verify HMAC-SHA256
    body_bytes = await request.body()
    computed_sig = hmac.new(
        API_KEY.encode(),
        body_bytes,
        hashlib.sha256
    ).hexdigest()

    if not hmac.compare_digest(computed_sig, x_famgateway_signature or ""):
        raise HTTPException(status_code=401, detail="Invalid signature")

    # Step 2: Parse JSON payload
    data = await request.json()
    if data.get("event") == "payment.success":
        order_id = data.get("order_id")
        amount = data.get("amount")
        utr = data.get("utr")
        sender = data.get("sender_name", "UPI Customer")

        # Step 3: Dispatch Instant Telegram Alert
        text = f"*Payment Received via FamGateway*\n\n" \
               f"• Amount: Rs. {amount}\n" \
               f"• Order ID: `{order_id}`\n" \
               f"• Bank UTR: `{utr}`\n" \
               f"• Sender: {sender}"

        requests.post(
            f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage",
            json={"chat_id": ADMIN_CHAT_ID, "text": text, "parse_mode": "Markdown"}
        )

    return {"status": "ok"}

6. Enterprise Security: SSRF Protection & Cryptographic Signatures

Opening up multiple webhook destinations creates potential security risks if not architected with defensive controls. FamGateway applies two enterprise-grade defense layers to all endpoints:

  1. Server-Side Request Forgery (SSRF) Defense: When adding or testing an endpoint, FamGateway resolves the target domain's IP address. If the target attempts to resolve to loopback interfaces (127.0.0.1/8, ::1) or private subnet addresses (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), the request is rejected immediately. This prevents malicious actors from probing internal infrastructure.
  2. HMAC-SHA256 Cryptographic Signing: Every outgoing webhook carries the header X-FamGateway-Signature. Because the signature requires knowledge of your private Default API Key, no third party can forge fake payment success notifications to your server.
  3. Replay Attack Immunity: Payloads include a timestamp and unique order_id and transaction_id fields, allowing receivers to enforce strict idempotency and discard replayed transmissions.

7. Frequently Asked Questions (FAQ)

Can I send FamGateway webhooks to both my website and a Telegram bot simultaneously?

Yes. With FamGateway's Multiple Webhook Endpoints feature, you can register distinct URLs for your primary web store, a Telegram notification bot, a Discord role bot, or a backup accounting database. Every successful payment event is fanned out in parallel to all active destinations.

How does FamGateway prevent a slow or failing webhook endpoint from delaying others?

FamGateway uses an asynchronous fan-out queue architecture (webhook_jobs). When a payment is verified, independent delivery jobs are queued for each active endpoint. If one destination server times out or returns HTTP 500, its automated retry schedule operates in complete isolation and will never delay or block delivery to your other endpoints.

How do I verify the authenticity and integrity of incoming multi-webhook payloads?

Every HTTP POST request sent by FamGateway includes an X-FamGateway-Signature header containing an HMAC-SHA256 hash computed over the raw JSON payload using your Default API Key as the secret. By recomputing the HMAC in your code, you can cryptographically verify that the webhook originated from FamGateway.

What is the difference between pausing and deleting a webhook endpoint in FamGateway?

Pausing an endpoint temporarily stops all outgoing webhook deliveries to that URL without removing its configuration or historical logs. You can resume deliveries with a single click once your maintenance is complete. Deleting an endpoint permanently removes the destination URL from your account.

Are there any additional fees or transaction commissions for using multiple webhooks?

No. FamGateway maintains a strict 0.0% transaction fee and zero-MDR policy across all features. You can configure and manage multiple webhook endpoints with unlimited delivery attempts at zero additional cost.


8. Enterprise Trust and Compliance

FamGateway is maintained by ARYANISPE, an entity registered with the Ministry of Micro, Small & Medium Enterprises, Government of India, under UDYAM Registration: UDYAM-BR-28-0050000. All transactions processed via FamGateway are non-custodial direct peer-to-peer UPI transfers settled over the National Payments Corporation of India (NPCI) network directly to your personal UPI ID.

Topic Cluster & Series

Related Developer Guides & Resources

View All 58+ Guides →
Python Cloud

How to Host a Free Python Telegram Payment Bot on PythonAnywhere (Zero Hosting & Gateway Fees with FamGateway)

Complete developer tutorial on deploying an automated UPI payment collection Telegram bot on PythonAnywhere...

Read Guide →
Security Audit

Is ZapUPI Safe or Fake? 2026 Technical Audit, Code Decompilation & Security Review

An independent technical security audit and developer review of ZapUPI. We decompile public integration pac...

Read Guide →
Gateway Comparison

Best ZapUPI Alternative in India: FamGateway vs ZapUPI (Zero-Fee, Non-Custodial UPI Gateway Comparison 2026)

In-depth technical and architectural comparison between FamGateway and ZapUPI. Discover why non-custodial, ...

Read Guide →

Back to Homepage →

About the Platform

FamGateway is an official unit of ARYANISPE, founded by Aryan Gupta (Aryanispe) and officially registered under the Ministry of Micro, Small and Medium Enterprises (MSME), Government of India (Reg: UDYAM-BR-28-0050000).

All Systems Operational