FAM Gateway API Documentation
Integrate UPI payments into your website or app using the FAM Gateway REST API.
Authentication
This documentation is public and can be viewed without signing in. API requests still require a valid API key issued for your integration.
Send your key in the X-API-KEY request header. The api_key field is also supported where applicable.
X-API-KEY: YOUR_API_KEY
Never publish your real API key in frontend JavaScript, screenshots, public repositories, or shared code. Keep it on your server.
Create payment
POST https://www.fam.hostaura.in/api/create.php
Fields: amount (required), order_id, remark, redirect_url.
curl -X POST "https://www.fam.hostaura.in/api/create.php" \\ -H "X-API-KEY: YOUR_API_KEY" \\ -d "amount=499" \\ -d "order_id=ORD1001" \\ -d "redirect_url=https://yoursite.com/thanks"
Example response:
{
"success": true,
"token": "PAYMENT_TOKEN",
"payment_url": "https://www.fam.hostaura.in/pay.php?t=PAYMENT_TOKEN",
"amount": 499,
"pay_amount": 499,
"expires_at": 1790913728
}
Redirect your customer to payment_url. pay_amount may differ from amount by a few paise when another payment link for the same amount is already open. Show the customer the exact amount returned by the API.
Check payment status
GET https://www.fam.hostaura.in/api/status.php?token=PAYMENT_TOKEN
You can also query using ?order_id=YOUR_ORDER_ID where supported by your integration.
Status values: pending, success, failed.
Webhook
When a payment succeeds, FAM Gateway sends a POST request containing JSON similar to this example:
{
"event": "payment.success",
"token": "PAYMENT_TOKEN",
"order_id": "ORD1001",
"amount": 499,
"paid_amount": 499,
"utr": "EXAMPLE_UTR",
"remark": "",
"paid_at": 1790912828
}
Verify the HMAC-SHA256 signature before trusting the webhook:
$body = file_get_contents('php://input');
$sig = $_SERVER['HTTP_X_SIGNATURE'] ?? '';
$expected = hash_hmac('sha256', $body, 'YOUR_WEBHOOK_SECRET');
$ok = hash_equals($expected, $sig);
if (!$ok) {
http_response_code(401);
exit;
}
http_response_code(200);
Respond with an HTTP 2xx status after successfully processing the event. For additional safety, verify the payment using the status endpoint before fulfilling an order.