Skip to main content
The SDKs handle the token exchange, retries, pagination, typed errors and webhook verification, so your code only deals with payments. Prefer plain HTTP? Every guide in these docs shows the raw requests too.

Node.js / TypeScript

Node 18 or later, ESM or CommonJS, no runtime dependencies. Run it on your server only: it holds your API secret.

What it does for you

  • Authentication. It exchanges your key and secret for a token on the first call, reuses it, and renews it before it expires. You never call /auth yourself.
  • Scopes. Pass scopes with what this service needs. A missing one throws KoriPermissionError, and error.requiredScopes tells you which scope to add.
  • Pagination. await kori.payouts.list() returns the first page. for await (const p of kori.payouts.list()) walks every page.
  • Errors. Each failure throws a typed error (KoriValidationError, KoriConflictError, KoriRateLimitError, and so on) that carries the requestId. Quote that ID to support.
  • Safe retries. Reads are retried after network errors and 5xx. payments.collect, payments.deposit and payouts.create are never repeated after a timeout, because the customer may already have been prompted. Look the payment up by your reference instead.
  • Webhooks. kori.webhooks.verify(rawBody, signature, secret) checks the signature and returns the typed event. See Webhooks.

Waiting for a payment

This polls payment status. Use it only while a customer is waiting on screen. Webhooks remain the reliable signal.