Skip to content

Initialize Session

Create a new checkout session for collecting a payment.

POST /v1/checkout/session/initialize

Authentication

This endpoint accepts both secret keys (sk_*) and public keys (pk_*).

Key typeUse caseOrigin validation
Secret keyServer-to-server (standard checkout, API-only)None
Public keyClient-side (inline checkout SDK)Enforced if allowedDomains is configured on the key

Inline checkout: no backend required

Inline Checkout uses your public key to call this endpoint directly from the browser. You don't need a backend server to accept payments with inline checkout. Configure allowedDomains on your API key to restrict which domains can use it. See Domain Whitelisting.

Request body

ParameterTypeRequiredDescription
amountintegerYesAmount in kobo (minor units). Minimum: 100 (NGN 1.00)
emailstringYesCustomer's email address
customer_namestringNoCustomer's name (max 255 chars). Displayed in dashboard instead of "Anonymous"
currencystringNoCurrency code (max 3 chars). Default: "NGN"
referencestringNoYour unique reference for reconciliation and idempotency (max 255 chars). Same reference and amount returns the active session; same reference with a new amount replaces it. See idempotency
callback_urlstringNoURL to redirect after payment, required for standard checkout (max 2048 chars)
metadataobjectNoCustom key-value data stored with the session
payment_methodsstring[]NoMethods to offer: "bank_transfer", "payid", "card", "crypto". Omit for the methods configured on your key (default ["bank_transfer", "payid"]). An explicit list is honoured exactly — include "crypto" (or pass crypto_assets) to offer it; crypto joins automatically only when payment_methods is omitted. Pass only ["crypto"] for a crypto-only checkout. See Payment Methods
crypto_assetsstring[]NoNarrow the crypto assets offered: "USDT:TRON" (one network) or "USDT" (every network). Only assets enabled on your key can appear. Omit to offer every eligible asset

Example request

bash
curl -X POST https://api.zevpaycheckout.com/v1/checkout/session/initialize \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk_test_your_secret_key" \
  -d '{
    "amount": 500000,
    "email": "customer@example.com",
    "customer_name": "John Doe",
    "currency": "NGN",
    "reference": "ORDER-12345",
    "callback_url": "https://yoursite.com/callback",
    "metadata": {
      "order_id": "12345"
    },
    "payment_methods": ["bank_transfer", "payid"]
  }'
javascript
const response = await fetch(
  "https://api.zevpaycheckout.com/v1/checkout/session/initialize",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": "sk_test_your_secret_key",
    },
    body: JSON.stringify({
      amount: 500000,
      email: "customer@example.com",
      customer_name: "John Doe",
      currency: "NGN",
      reference: "ORDER-12345",
      callback_url: "https://yoursite.com/callback",
    }),
  }
);

const { data } = await response.json();
console.log(data.session_id);   // "ecc48011-e36e-4741-9b99-657f4a1ee86e"
console.log(data.checkout_url); // "https://secure.zevpaycheckout.com/ecc48011-..."
python
import requests

response = requests.post(
    "https://api.zevpaycheckout.com/v1/checkout/session/initialize",
    headers={
        "Content-Type": "application/json",
        "x-api-key": "sk_test_your_secret_key",
    },
    json={
        "amount": 500000,
        "email": "customer@example.com",
        "customer_name": "John Doe",
        "currency": "NGN",
        "reference": "ORDER-12345",
        "callback_url": "https://yoursite.com/callback",
    },
)

data = response.json()["data"]
print(data["session_id"])
print(data["checkout_url"])
php
$ch = curl_init("https://api.zevpaycheckout.com/v1/checkout/session/initialize");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Content-Type: application/json",
        "x-api-key: sk_test_your_secret_key",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "amount" => 500000,
        "email" => "customer@example.com",
        "customer_name" => "John Doe",
        "currency" => "NGN",
        "reference" => "ORDER-12345",
    ]),
]);
$response = json_decode(curl_exec($ch), true);
$sessionId = $response["data"]["session_id"];

Response

json
{
  "success": true,
  "data": {
    "session_id": "ecc48011-e36e-4741-9b99-657f4a1ee86e",
    "reference": "ZVP-CKO-S-1772906868046-d5aa1c0b99153aae4766af242e656e80",
    "merchant_reference": "ORDER-12345",
    "checkout_url": "https://secure.zevpaycheckout.com/ecc48011-e36e-4741-9b99-657f4a1ee86e",
    "amount": 500000,
    "currency": "NGN",
    "expires_at": "2026-03-07T19:37:00.000Z",
    "merchant_name": "Your Business Name",
    "enabled_payment_methods": ["bank_transfer", "payid"]
  }
}

Response fields

FieldTypeDescription
session_idstringUnique session identifier (UUID)
referencestringOur unique payment reference (prefix: ZVP-CKO-S)
merchant_referencestring | nullYour reference (if provided)
checkout_urlstringURL for standard checkout redirect
amountintegerAmount in kobo (same as request)
currencystringCurrency code
expires_atstringISO 8601 expiry timestamp (30 minutes from creation)
merchant_namestring | nullYour business name from checkout configuration
enabled_payment_methodsstring[]Active payment methods for this session. Includes "crypto" when the key qualifies, see Crypto
crypto_assetsarray | nullCrypto assets offered on this session, each { assetCode, network, displayName, decimals }. Null when crypto is not offered

Errors

StatusMessageCause
400Validation errorMissing or invalid parameters (e.g., amount must not be less than 100)
401Invalid API keyKey not found or inactive
403Origin not allowed for this API keyPublic key used from unauthorized domain

Try it

API Playground
POSThttps://api.zevpaycheckout.com/v1/checkout/session/initialize

ZevPay Checkout Developer Documentation