FamGateway Introduces Multiple Webhook Endpoints: Broadcast Real-Time UPI Payments to Multiple Servers & Bots Simultaneously (Old vs New Architecture Breakdown)
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.
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:
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:
merchant_webhooks and computes a cryptographically signed HMAC-SHA256 signature using your Default API Key.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:
- Endpoint Name / Label: Enter a recognizable label, such as
Telegram Store BotorBackup Database. - Webhook Destination URL: Enter your HTTPS webhook URL (e.g.
https://mybot.example.com/api/famgateway-webhook). - 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:
- 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. - 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. - Replay Attack Immunity: Payloads include a
timestampand uniqueorder_idandtransaction_idfields, 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.
- Configure Your Endpoints: FamGateway Webhooks Dashboard
- API Reference & Payload Schema: Webhook Documentation
- Python Package (PyPI): famgateway on PyPI
- MSME Verification: Government MSME Verification Record
Related Developer Guides & Resources
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...
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...
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, ...