FamGateway Releases Official Python SDK on PyPI: Zero-Fee UPI Payment Gateway Integration for Python Developers (2026)
We are excited to announce the official release of the FamGateway Python SDK on the Python Package Index (PyPI): famgateway. Starting today, Indian developers, indie hackers, Telegram bot creators, and SaaS founders can integrate seamless, zero-fee Peer-to-Peer UPI payments into any Python application with just three lines of clean, type-annotated Python code.
- Package Name:
famgateway(Version 1.0.1) - Installation:
pip install famgateway - Official PyPI Page: https://pypi.org/project/famgateway/
- License: MIT Open Source
- Maintainer Entity: ARYANISPE (Ministry of MSME Reg:
UDYAM-BR-28-0050000)
1. Why Indian Python Developers Needed a Native UPI SDK
Python powers a massive portion of India's developer ecosystem: from FastAPI and Flask backends to automated Telegram bots, Discord servers, AI agent interfaces, and micro-SaaS applications. However, accepting UPI payments in Python backends has historically required navigating two broken extremes:
- Legacy Aggregators (Razorpay, Cashfree, PayU): Require business entity registration (Pvt Ltd / LLP), active GSTIN credentials, lengthy merchant onboarding approval delays, 2%–3% commission deduction on every sale, and 48-hour custodial settlement cycles.
- Unmaintained Third-Party Scrapers: Brittle, unauthorized scraping scripts that break whenever web interfaces update, risking API credential exposure and account blocks.
FamGateway solves this problem permanently. By combining an enterprise API orchestration layer with automated IMAP bank verification and non-custodial P2P UPI routing, FamGateway provides a robust, developer-first bridge that brings instant UPI automation to standard Python environments with zero platform fees.
2. Key Architecture and Features of the `famgateway` Library
The famgateway SDK was designed from the ground up to follow modern Python best practices, type safety, and minimalistic dependency footprints.
Instant Dynamic QR Codes
Direct order.qr_url image links ready to be embedded in web HTML, sent to mobile clients, or delivered via bot.send_photo() in Telegram/Discord.
Deep Intent URLs
Automated order.upi_intent links (upi://pay?...) that launch PhonePe, Google Pay, and Paytm with pre-filled amount and reference IDs in 1 tap.
Strict Typed Models
Structured dataclass responses (OrderResponse, OrderStatus) with IDE auto-completion and automatic type validation.
Clean Exception Hierarchy
Granular exception handling with AuthenticationError, APIError, OrderNotFoundError, and NetworkError.
3. Installation and Quickstart Tutorial
Step 1: Install from PyPI
Open your terminal or command prompt and run:
pip install famgateway
Step 2: Generate an Order in 3 Lines of Python
Initialize the FamGateway client with your API key (obtained from your FamGateway Dashboard) and create an order:
from famgateway import FamGateway
# Initialize client
fg = FamGateway(api_key="fam_your_api_key_here")
# Create a dynamic UPI order for Rs. 250.00
order = fg.create_order(
amount=250.0,
customer_name="Aryan Gupta",
customer_phone="9876543210"
)
print(f"Order Created: {order.order_id}")
print(f"Payable Amount: Rs. {order.payable_amount}")
print(f"Direct QR Image: {order.qr_url}")
print(f"Hosted Checkout URL: {order.checkout_url}")
Step 3: Check Payment Status
Verify whether the customer has completed the payment:
status = fg.get_status(order.order_id)
if status.is_paid:
print("Payment Captured Successfully!")
print(f"Bank UTR: {status.utr}")
print(f"FamPay Txn ID: {status.transaction_id}")
elif status.is_pending:
print("Awaiting customer payment...")
elif status.is_expired:
print("Order has expired.")
4. Framework Integration Examples
A. FastAPI / Flask Webhook Verification
FamGateway dispatches real-time webhooks with an X-FamGateway-Signature header generated via HMAC-SHA256. Here is how you can verify webhook authenticity in FastAPI:
import hmac
import hashlib
from fastapi import FastAPI, Request, HTTPException, Header
app = FastAPI()
WEBHOOK_SECRET = "your_famgateway_api_secret"
@app.post("/api/famgateway-webhook")
async def handle_famgateway_webhook(request: Request, x_famgateway_signature: str = Header(None)):
raw_body = await request.body()
# Calculate HMAC-SHA256 signature
computed_signature = hmac.new(
WEBHOOK_SECRET.encode("utf-8"),
raw_body,
hashlib.sha256
).hexdigest()
if not hmac.compare_digest(computed_signature, x_famgateway_signature or ""):
raise HTTPException(status_code=401, detail="Invalid webhook signature")
data = await request.json()
if data.get("status") == "success":
order_id = data.get("order_id")
amount = data.get("amount")
utr = data.get("utr")
print(f"Webhook Verified: Order {order_id} paid Rs {amount} with UTR {utr}")
# Activate digital access or credit database balance here
return {"status": "ok"}
B. Telegram Bot In-Chat Payments (`pyTelegramBotAPI`)
Accept payments directly inside Telegram chats without external website drops:
import telebot
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
from famgateway import FamGateway
bot = telebot.TeleBot("YOUR_TELEGRAM_BOT_TOKEN")
fg = FamGateway(api_key="YOUR_FAMGATEWAY_API_KEY")
@bot.message_handler(commands=['deposit'])
def handle_deposit(message):
order = fg.create_order(
amount=100.0,
customer_name=f"{message.from_user.first_name} ({message.from_user.id})"
)
markup = InlineKeyboardMarkup()
markup.row(
InlineKeyboardButton("Pay Online / UPI Apps", url=order.checkout_url),
InlineKeyboardButton("Verify Payment", callback_data=f"chk:{order.order_id}:100.0")
)
caption = (
f"Payment Details:\n\n"
f"Amount to Pay: Rs {order.payable_amount}\n"
f"Order ID: `{order.order_id}`\n\n"
f"Scan the QR code with PhonePe, Google Pay, or Paytm.\n"
f"After paying, tap 'Verify Payment' to credit your account."
)
bot.send_photo(
chat_id=message.chat.id,
photo=order.qr_url,
caption=caption,
parse_mode="Markdown",
reply_markup=markup
)
@bot.callback_query_handler(func=lambda call: call.data.startswith("chk:"))
def handle_verify(call):
_, order_id, amount_str = call.data.split(":")
status = fg.get_status(order_id)
if status.is_paid:
bot.answer_callback_query(call.id, "Payment Verified! Wallet Credited.", show_alert=True)
bot.send_message(call.message.chat.id, f"Payment Confirmed! Bank UTR: `{status.utr}`")
else:
bot.answer_callback_query(call.id, "Payment pending. Please complete UPI transfer.", show_alert=True)
bot.infinity_polling()
5. Architectural Comparison: FamGateway vs Traditional Aggregators
| Feature | FamGateway Python SDK | Razorpay / Cashfree |
|---|---|---|
| Transaction Commission | 0.0% (Zero Fees Forever) | 2.0% - 2.5% + 18% GST |
| Settlement Window | 0 Seconds (Direct to Bank) | T+2 Business Days (Escrow Hold) |
| Business KYC / GST Requirement | None (Personal UPI Supported) | Mandatory GST & Incorporation Docs |
| In-Chat Telegram Bot QR | Supported (`qr_url` Image) | Not Supported (Forced Web Redirect) |
| Package Overhead | Under 25 KB (Zero Bloat) | Over 1.5 MB with heavy dependencies |
| Open Source License | MIT Open Source | Proprietary / Vendor Locked |
6. Legal Compliance and Enterprise Trust
FamGateway is developed and maintained by ARYANISPE, an entity officially registered with the Government of India Ministry of Micro, Small & Medium Enterprises under UDYAM Registration: UDYAM-BR-28-0050000. All transactions processed via FamGateway are direct peer-to-peer bank transfers settled over the National Payments Corporation of India (NPCI) Unified Payments Interface network.
For more information, API documentation, or community developer support, explore the following official resources:
- PyPI Package: pypi.org/project/famgateway
- Official Documentation: famgateway.in/docs.php
- MSME Verification Guide: UDYAM-BR-28-0050000 Entity Record
- Architecture Deep-Dive: Concurrency & Concurrency Locking Whitepaper
Related Developer Guides & Resources
UDYAM-BR-28-0050000: Official MSME Verification & Enterprise Ownership Details of ARYANISPE (FamGateway)
Who owns UDYAM-BR-28-0050000? Official Government of India MSME registration details for ARYANISPE, founded...
How FamGateway Handles Concurrent UPI Payments & Race Conditions at Scale: Engineering Architecture Deep-Dive (2026)
Technical deep-dive into how FamGateway handles high-volume concurrent UPI payments, multi-UID IMAP batch i...
Instant Merchant Payment Notification Emails: How FamGateway Automates Real-Time Transaction Receipts (2026)
Discover how FamGateway automatically sends instant, real-time payment notification emails to merchants wit...