Skip to content

TypeScript SDK

@gryphem-pay/sdk is a zero-dependency client built on fetch, with types generated from the OpenAPI contract. It runs on Node.js 20+, Deno, Bun and edge runtimes.

Terminal window
pnpm add @gryphem-pay/sdk
import { Gryphem, GryphemError } from '@gryphem-pay/sdk';
const gp = new Gryphem({
apiKey: process.env.GRYPHEM_API_KEY!, // gp_live_…
baseUrl: 'https://api.feitpay.com',
timeoutMs: 30_000, // per attempt
maxRetries: 2, // GET and idempotent POST only
});
Namespace Methods
paymentIntents create, retrieve, list, cancel, resolve, timeline
checkoutSessions create, retrieve
invoices create, retrieve, list, void
paymentLinks create, retrieve, list, update
transactions list, retrieve
wallets create, retrieve, list, disable, createOwnershipChallenge, submitOwnershipProof
stores, organizations, customers list / retrieve
webhookEndpoints create, list, retrieve, update, rotateSecret, sendTest
webhookDeliveries list, retrieve, retry
events list, retrieve
reports payments (CSV string or JSON), reconciliation
billing invoices, usage
auditEvents list
platform capabilities, networks, assets, health
  • Idempotency — create methods send an Idempotency-Key automatically (gp_sdk_…) and reuse it across retries. Pass { idempotencyKey } to tie it to your own order id.
  • Retries — exponential backoff with full jitter (honouring Retry-After) on network errors, 429 and 5xx, for GET and keyed POST only.
  • Pagination — await gp.invoices.list() returns a page; for await (const inv of gp.invoices.list()) walks all pages; .toArray(max) collects a bounded number.
  • Errors — every failure is a GryphemError subclass with type, code, param, requestId and status.
  • Money — amounts are strings. formatBaseUnits('99834', 8) === '0.00099834' uses BigInt, never floats.
  • Path safety — ids are encoded as a single path segment.
try {
const intent = await gp.paymentIntents.retrieve('pi_…');
if (intent.fulfillable) ship(intent.merchant_order_id);
} catch (err) {
if (err instanceof GryphemError && err.type === 'not_found_error') return null;
throw err;
}