Developers
Accept wallet payments with three API calls.
Hosted checkout, signed webhooks, partial refunds and a sandbox, with copy-paste examples in cURL, Node.js and PHP.
Developers
Hosted checkout, signed webhooks, partial refunds and a sandbox, with copy-paste examples in cURL, Node.js and PHP.
Create API keys in the PayNest merchant app (Settings → API keys) or the merchant web dashboard. Each key pair has a public key and a secret key shown once. Send the secret as a Bearer token from your server only, never from a browser or app.
Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxxBase URL: https://paynest.techiegenz.one/api/v1. Amounts are integers in the currency's minor unit (paise for INR, so ₹499.00 is 49900).
Create a session for each order, then redirect the customer to its url. They pay by scanning the QR with the PayNest app or by signing in on the page. Sessions are idempotent per orderRef.
curl -X POST https://paynest.techiegenz.one/api/v1/gateway/sessions \
-H "Authorization: Bearer sk_test_…" -H "Content-Type: application/json" \
-d '{"amount":49900,"currency":"INR","orderRef":"ORD-1042",
"successUrl":"https://shop.example/paid","cancelUrl":"https://shop.example/cart"}'{
"id": "cmx…", "object": "checkout_session", "mode": "SANDBOX",
"amount": 49900, "currency": "INR", "orderRef": "ORD-1042", "status": "OPEN",
"url": "https://paynest.techiegenz.one/checkout/cmx…", "expiresAt": "…"
}const res = await fetch("https://paynest.techiegenz.one/api/v1/gateway/sessions", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PAYNEST_SECRET}`, "Content-Type": "application/json" },
body: JSON.stringify({ amount: 49900, currency: "INR", orderRef: order.id, successUrl, cancelUrl }),
});
const session = await res.json();
redirect(session.url);$ch = curl_init("https://paynest.techiegenz.one/api/v1/gateway/sessions");
curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("PAYNEST_SECRET"), "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode(["amount" => 49900, "currency" => "INR", "orderRef" => $orderId,
"successUrl" => $successUrl, "cancelUrl" => $cancelUrl])]);
$session = json_decode(curl_exec($ch), true);
header("Location: " . $session["url"]);After the redirect to successUrl?session_id=…&status=paid, always confirm on your server before fulfilling the order.
curl https://paynest.techiegenz.one/api/v1/gateway/sessions/{id} -H "Authorization: Bearer sk_live_…"
# → { "status": "PAID", "transactionId": "…", … } (OPEN · PAID · EXPIRED · CANCELLED · REFUNDED)Refund all or part of a payment by its transaction reference (shown in the merchant app and sent in webhooks). Total refunds can't exceed the original amount; refunds reach the customer's wallet instantly.
curl -X POST https://paynest.techiegenz.one/api/v1/gateway/refunds -H "Authorization: Bearer sk_live_…" -H "Content-Type: application/json" \
-d '{"ref":"PN2611243K7Q9X2M","amount":10000,"reason":"Item out of stock"}'Add your endpoint in the merchant app or dashboard. We send payment.success and payment.refunded as JSON POSTs, retrying with backoff for about 20 hours until you answer with a 2xx. Verify every call with your webhook secret:
X-PayNest-Signature: t=1764000000,v1=5f2c… (HMAC-SHA256 of "t.rawBody" with your webhook secret)import crypto from "node:crypto";
function verify(rawBody, header, secret) {
const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
return fresh && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}[$t, $v1] = array_map(fn($p) => explode("=", $p)[1], explode(",", $_SERVER["HTTP_X_PAYNEST_SIGNATURE"]));
$expected = hash_hmac("sha256", $t . "." . file_get_contents("php://input"), $secret);
$valid = hash_equals($expected, $v1) && abs(time() - (int)$t) < 300;No code needed: create payment links in the app (fixed or open amount, optional usage limit and expiry) and share them anywhere. Each link has its own page and QR. In-store, show your store QR or use counter mode for a fresh amount QR per bill.
Keys starting with sk_test_ create sandbox sessions: the checkout works end to end and webhooks fire, but no money moves. Switch to an sk_live_ key when you go live.
Errors return a non-2xx status with a JSON body:
{ "error": { "code": "invalid_api_key", "message": "Unknown or revoked API key", "details": {} } }401 invalid_api_key: missing, wrong or revoked key422 validation_error: check details.issues400 domain_not_allowed: the success URL isn't in the key's allowed domains400 refund_too_large: more than the refundable amount410 session_closed: expired or already paid