Skip to content

Quickstart

This guide takes you from an API key to a completed test payment. It takes about ten minutes.

  • 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:

Terminal window
export NOGORPAY_API_KEY="sk_live_xxxxxxxxxxxxxxxx"
  1. Call POST /charge/create from 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"
    }'

    The response contains the invoice_id and the payment_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_id against your order. You will use it to verify the payment.

  2. 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 your redirect_url, or to cancel_url if they cancel.

  3. 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.completed to your webhook_url. Verify the signature, then mark the order as paid.
    • Verify API. Call GET /charge/verify/{invoice_id} and check that status is completed and amount matches your order.
    Terminal window
    curl https://api.nogorpay.com/api/v1/charge/verify/INV-7K9X2P8M \
    -H "NOGORPAY-API-KEY: $NOGORPAY_API_KEY"