Skip to content

Initialize Session

Create a new checkout session for collecting a payment.

POST /v1/checkout/session/initialize

Required permission: checkout

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

The Inline Checkout SDK 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 (max 255 chars)
callback_urlstringNoURL to redirect after payment — required for standard checkout (max 2048 chars)
metadataobjectNoCustom key-value data stored with the session
payment_methodsstring[]NoEnabled methods: "bank_transfer", "payid". Default: ["bank_transfer", "payid"]

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)
referencestringZevPay's 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

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