WEBHOOKS & INTEGRATION
Webhooks & Callbacks Guide
OnnXpay uses HTTPS webhooks to notify your application asynchronously when payment events happen. Configure your callback_url during deposit order creation to receive real-time POST events.
Webhook JSON Event Schema
JSON
{
"payment_id": "pay_a75d6c7382fa4501",
"order_id": "MERC_TEST_4821",
"status": "completed",
"amount_usdt": 11.52,
"amount_inr": 1000,
"tx_hash": "0x7d025b...3a9f02",
"payer_name": "John Doe",
"utr_number": "220912882711",
"vendor_id": "VND2026001",
"exchange_rate": 86.8,
"timestamp": 1784651100000
}Webhook Processing & Implementation
When vendor payment verification is completed during settlement, OnnXpay dispatches an HTTP POST request containing the JSON payload directly to your configured callback_url:
JAVASCRIPT
// Example Node.js / Express Webhook Handler
app.post('/api/onnxpay-callback', (req, res) => {
const { payment_id, order_id, status, amount_usdt, amount_inr, utr_number } = req.body;
if (status === 'completed') {
// 1. Fulfill order in your database
console.log(`Order ${order_id} (Payment: ${payment_id}) succeeded. UTR: ${utr_number}`);
}
// Always acknowledge receipt with HTTP 200 OK
return res.status(200).json({ received: true });
});Response Expectations
Your endpoint should respond promptly with an HTTP 200 OK status code and a JSON body {"received": true} upon receiving the payload.
Webhooks are fired immediately upon settlement confirmation. Ensure your callback endpoint is publicly accessible via HTTPS.