Your server creates a payment page with your secret key and sends the customer to its link. When the phone confirms the payment, we call your webhook. Your server then marks the order paid. Never trust the browser or the return link for that.
Send your secret key as a bearer token. Keys start with sk_live_ and are made under Phone and keys. Keep them on your server.
Authorization: Bearer sk_live_...POST https://xpay4u.onrender.com/api/v1/sessions
Content-Type: application/json
{
"amount": 500,
"reference": "ORDER-1042",
"return_url": "https://yourstore.com/thanks"
}amount is the price in pesos, from 1 to 1,000,000. reference is your own order number, up to 100 characters, and must be unique per store. return_url is optional and must be https.
Response (201):
{
"id": "S-7K2M9QX4TB8C",
"status": "waiting",
"customer_pays": 502.37,
"pay_url": "https://xpay4u.onrender.com/pay/S-7K2M9QX4TB8C",
"expires_in": 600
}customer_pays is your price, plus the platform fee once your trial is over, plus 1 to 99 extra centavos that belong to this page alone. Redirect the customer to pay_url.
Sending the same reference again while its page is still open returns that page again with status 200. Once a reference has expired or been paid, it cannot be reused: the answer is 409.
GET https://xpay4u.onrender.com/api/v1/sessions/S-7K2M9QX4TB8C
Authorization: Bearer sk_live_...
{ "id": "S-7K2M9QX4TB8C", "status": "paid", "reference": "ORDER-1042",
"customer_pays": 502.37, "merchant_income": 500.37, "paid_at": "2026-01-05T08:12:44.000Z" }status is one of waiting, paid, expired, review. Use this to double-check when a webhook is late. Prefer the webhook as the main signal.
Set your webhook address in Settings. When a page is paid we send a POST with a JSON body:
{
"event": "session.paid",
"id": "S-7K2M9QX4TB8C",
"reference": "ORDER-1042",
"customer_paid": 502.37,
"merchant_income": 500.37,
"paid_at": "2026-01-05T08:12:44.000Z"
}Two headers come with it: X-Timestamp (unix seconds) and X-Signature, the hex HMAC-SHA256 of <timestamp>.<raw body> using your webhook signing secret (it starts with whsec_, shown in Settings). It is a different secret from your API key.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyWebhook(rawBody, headers, secret) {
const ts = headers["x-timestamp"];
const sig = headers["x-signature"] ?? "";
if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
const want = createHmac("sha256", secret).update(ts + "." + rawBody).digest("hex");
return sig.length === want.length && timingSafeEqual(Buffer.from(sig), Buffer.from(want));
}Answer with any 2xx status to confirm. Anything else is retried after 1, 5, 30, 120 and 720 minutes, then marked failed. You can send a failed one again from Settings. A webhook can arrive more than once, so make your handler safe to repeat: look the order up by reference and ignore it if it is already paid.
| Status | Meaning |
|---|---|
| 400 | Missing or wrong field, such as amount or reference. |
| 401 | The key is missing, wrong or revoked. |
| 403 | The account is suspended, customer payments are switched off, or no wallet is switched on. |
| 404 | No such page for this store. |
| 409 | That reference was already used and its page is closed. |
| 429 | Too many requests. The limit is 120 a minute per key. |