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.
pnpm add @gryphem-pay/sdkimport { 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});Resources
Section titled “Resources”| 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 |
Behaviour
Section titled “Behaviour”- Idempotency — create methods send an
Idempotency-Keyautomatically (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,429and5xx, forGETand keyedPOSTonly. - 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
GryphemErrorsubclass withtype,code,param,requestIdandstatus. - Money — amounts are strings.
formatBaseUnits('99834', 8) === '0.00099834'usesBigInt, 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;}