Server SDK

A typed Node client for creating sessions from your own backend — the same shape as stripe-node. Use this when your server, not the browser, decides what to charge.

Install

npm install @zela-checkout/sdk

Usage

import { ZelaCheckoutClient } from "@zela-checkout/sdk";

const client = new ZelaCheckoutClient({
  secretKey: process.env.ZELA_SECRET_KEY!,
});

const { session, checkoutUrl } = await client.sessions.create({
  amount: "19.99",
  successUrl: "https://your.site/thanks",
  metadata: { orderId: "ord_123" },
});

// redirect your customer to checkoutUrl
console.log(session.id, session.status); // "cs_...", "awaiting_payment"

Retrieving a session

const session = await client.sessions.retrieve("cs_...");
console.log(session.status); // "awaiting_payment" | "settling" | "settled" | "expired" | "failed"

The SDK talks to the same REST API described in REST API — use whichever fits your stack; there’s nothing the SDK can do that a plain HTTP call can’t.