Create your first payment
Create a payment, send your customer to checkout, and confirm the result with a webhook. This walkthrough uses your API key and takes about five minutes end to end.
Before you start
You need your merchant API key and a server that can receive an HTTPS POST for the webhook. Keep the API key on your server, never in client code.
1. Create a payment session
Send a POST to /payments/session with the amount in whole rupees. The amount must be between ₹500 and ₹99,000.
curl -X POST https://api.xenonpay.net/api/payments/session \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"amount": 500,
"order_id": "order-123",
"customer_name": "Asha Sharma"
}'In Node.js:
const res = await fetch("https://api.xenonpay.net/api/payments/session", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.XENONPAY_API_KEY,
},
body: JSON.stringify({
amount: 500,
order_id: "order-123",
customer_name: "Asha Sharma",
}),
});
const session = await res.json();
// session.checkout_url is where you send the customerA successful call returns 201 with a checkout_url, a session_token, and the assigned UPI details.
2. Send your customer to checkout
Redirect the customer to the checkout_url from the response. They complete payment there over UPI and submit their transaction reference. The session expires 10 minutes after you create it.
3. Receive the webhook
When the payment is confirmed, we send a SUCCESS webhook to your configured URL. Treat this as the moment the payment is done. Verify the signature on every webhook before trusting it.
4. Poll status only if needed
If you miss a webhook, you can check the current state with GET /payments/session/{session_token}, within its rate limit.