JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 38
  • Score
    100M100P100Q94230F
  • License MIT

Official ZenoBank TypeScript SDK

Package Exports

  • @zenobank/sdk

Readme

@zenobank/sdk

Official TypeScript SDK for the Zeno Bank Crypto Payment Gateway API.

How it works

  1. Create a checkout with an amount and currency
  2. Redirect your customer to the checkoutUrl to complete the payment
  3. The customer pays with crypto
  4. Zeno Bank sends a webhook to your server when the checkout status changes (e.g. completed, expired)
  5. Verify the webhook signature and handle the event in your system

Installation

npm install @zenobank/sdk
# or
pnpm add @zenobank/sdk
# or
yarn add @zenobank/sdk

Quick Start

import { ZenoBankClient } from '@zenobank/sdk';

const zenoBank = new ZenoBankClient({
  apiKey: 'your-api-key',
});

// Create a checkout
const checkout = await zenoBank.checkouts.create({
  orderId: 'order-12345',
  priceAmount: '100',
  priceCurrency: 'USD',
  successRedirectUrl: 'https://example.com/success',
});

// Redirect your customer to this URL to complete the payment
console.log(checkout.checkoutUrl);
// => https://pay.zenobank.io/ch_0gJfH4a9B2Eg1jpES

checkouts.get(checkoutId)

Retrieve an existing checkout by ID.

const checkout = await zenoBank.checkouts.get('ch_0gJfH4a9B2Eg1jpES');

// checkout.id            — "ch_0gJfH4a9B2Eg1jpES" — Checkout ID
// checkout.orderId       — "order-12345" — Your order identifier
// checkout.priceCurrency — "USD" — Currency code
// checkout.priceAmount   — "100" — Amount requested in priceCurrency
// checkout.paidAmount    — "85.50" — Amount actually paid in priceCurrency
// checkout.status        — "OPEN" | "COMPLETED" | "EXPIRED" | "CANCELLED" | "PARTIALLY_PAID"

Webhooks

Receive notifications when a checkout status changes so you can handle it internally.

To start receiving webhooks, add your endpoint URL in the Zeno Bank Dashboard.

webhooks.verify(params): WebhookEvent

Verify that a webhook request is authentic and was sent by Zeno Bank. Returns a typed WebhookEvent. Throws if the signature or headers are invalid.

const event = zenoBank.webhooks.verify({
  secret: 'whsec_your_webhook_secret',  // From the Dashboard
  rawBody: req.body,                      // Raw request body (string or Buffer)
  headers: req.headers,                   // Request headers
});

Examples

Full working examples for popular JavaScript and TypeScript frameworks:

For more examples, see the zenobank-examples repository.

License

MIT