Quickstart
This guide takes you from an API key to a completed test payment. It takes about ten minutes.
Before you start
Section titled “Before you start”- A NogorPay account with at least one active payment gateway.
- A secret API key from Integrations → Connection settings. See Authentication.
- If you want webhooks, add your domain under Integrations → Allowed Webhook Domains first.
Store the key in an environment variable so the examples can read it:
export NOGORPAY_API_KEY="sk_live_xxxxxxxxxxxxxxxx"-
Create a charge
Section titled “Create a charge”Call
POST /charge/createfrom your server with the amount and at least one customer field.Terminal window curl -X POST https://api.nogorpay.com/api/v1/charge/create \-H "NOGORPAY-API-KEY: $NOGORPAY_API_KEY" \-H "Content-Type: application/json" \-d '{"amount": 1500,"order_id": "ORDER-1042","customer_phone": "01712345678","redirect_url": "https://yourstore.com/payment/success","cancel_url": "https://yourstore.com/payment/cancel","webhook_url": "https://yourstore.com/api/nogorpay/webhook"}'const res = await fetch('https://api.nogorpay.com/api/v1/charge/create', {method: 'POST',headers: {'NOGORPAY-API-KEY': process.env.NOGORPAY_API_KEY,'Content-Type': 'application/json',},body: JSON.stringify({amount: 1500,order_id: 'ORDER-1042',customer_phone: '01712345678',redirect_url: 'https://yourstore.com/payment/success',cancel_url: 'https://yourstore.com/payment/cancel',webhook_url: 'https://yourstore.com/api/nogorpay/webhook',}),});const charge = await res.json();if (!charge.success) throw new Error(charge.message);<?php$ch = curl_init('https://api.nogorpay.com/api/v1/charge/create');curl_setopt_array($ch, [CURLOPT_POST => true,CURLOPT_RETURNTRANSFER => true,CURLOPT_HTTPHEADER => ['NOGORPAY-API-KEY: ' . getenv('NOGORPAY_API_KEY'),'Content-Type: application/json',],CURLOPT_POSTFIELDS => json_encode(['amount' => 1500,'order_id' => 'ORDER-1042','customer_phone' => '01712345678','redirect_url' => 'https://yourstore.com/payment/success','cancel_url' => 'https://yourstore.com/payment/cancel','webhook_url' => 'https://yourstore.com/api/nogorpay/webhook',]),]);$charge = json_decode(curl_exec($ch), true);curl_close($ch);import osimport requestsres = requests.post("https://api.nogorpay.com/api/v1/charge/create",headers={"NOGORPAY-API-KEY": os.environ["NOGORPAY_API_KEY"]},json={"amount": 1500,"order_id": "ORDER-1042","customer_phone": "01712345678","redirect_url": "https://yourstore.com/payment/success","cancel_url": "https://yourstore.com/payment/cancel","webhook_url": "https://yourstore.com/api/nogorpay/webhook",},)charge = res.json()The response contains the
invoice_idand thepayment_url:{"success": true,"invoice_id": "INV-7K9X2P8M","order_id": "ORDER-1042","session_id": "cs_live_3f2a9c0e8b7d4e1fa6c5b4d3e2f1a0b9","payment_method": null,"payment_url": "https://pay.nogorpay.com/checkout/cs_live_3f2a9c0e8b7d4e1fa6c5b4d3e2f1a0b9","expires_at": "2026-08-07T12:15:00.000Z","server_time": "2026-08-07T12:00:00.000Z","expires_in_seconds": 900}Save
invoice_idagainst your order. You will use it to verify the payment. -
Redirect the customer
Section titled “Redirect the customer”Send the customer’s browser to
payment_url. They choose a payment method and complete payment on the NogorPay checkout page. When they finish, NogorPay sends them to yourredirect_url, or tocancel_urlif they cancel. -
Confirm the payment
Section titled “Confirm the payment”Don’t trust the redirect alone: a customer can open your success URL directly. Confirm the payment from your server in one of two ways:
- Webhook (recommended). NogorPay sends
charge.completedto yourwebhook_url. Verify the signature, then mark the order as paid. - Verify API. Call
GET /charge/verify/{invoice_id}and check thatstatusiscompletedandamountmatches your order.
Terminal window curl https://api.nogorpay.com/api/v1/charge/verify/INV-7K9X2P8M \-H "NOGORPAY-API-KEY: $NOGORPAY_API_KEY" - Webhook (recommended). NogorPay sends
