Payments

Handle plan upgrades, transaction history, and payment processing via the ZPay gateway. Automatic plan provisioning on successful payment.

💳

Secure Payment Flow

Payments are processed through ZPay with HMAC-signed webhooks. The checkout flow creates a pending transaction, redirects to the payment gateway, and auto-provisions the plan on callback.

Checkout Flow

Initiating a checkout creates a pending transaction and returns a payment URL. After successful payment, the ZPay callback automatically upgrades the organization's plan.

Initiate Checkout

POST /payments/checkout

{
  "plan_id": "pro",
  "billing_cycle": "monthly"
}

// Response
{
  "txn_id": "txn_abc123",
  "payment_url": "https://pay.zpay.in/checkout/...",
  "amount": 999,
  "currency": "INR"
}

Payment Callback

ZPay sends an HMAC-signed webhook to confirm payment success or failure. The plan is auto-provisioned on success.

POST /payments/zpay-callback

// Handled automatically by zMesh
// - Verifies HMAC signature
// - Updates transaction status (success/failed)
// - Upgrades org plan on success
// - Sends confirmation email

Transaction History

Check Transaction Status

GET /payments/status/{txn_id}

// Response
{
  "txn_id": "txn_abc123",
  "status": "success",  // pending | success | failed
  "amount": 999,
  "currency": "INR",
  "plan": "pro",
  "created_at": "2026-03-27T10:00:00Z"
}

List Transactions

GET /payments/my-transactions

Authorization: Bearer <token>

// Returns all transactions for the current user
// Includes: txn_id, amount, currency, status, plan, created_at