@membber/sdk-ts is a thin, fully typed client over the platform contract: every path, parameter, request body and response is typed end to end, generated from the same source as this reference.
The package is not on npm yet; publishing is planned. Today it ships inside the Membber platform workspace, and we provide it directly to teams building with us. If that is you, get in touch and we will set you up. Everything on this page works identically once it is on npm.
The SDK targets Node 18+ and modern bundlers, has a single runtime dependency (openapi-fetch), and works anywhere fetch exists, including edge runtimes.
import { createMembberClient } from "@membber/sdk-ts";
const membber = createMembberClient({
// Attached as "Authorization: Bearer <token>" on every request.
getAccessToken: () => process.env.MEMBBER_TOKEN,
});
// Liveness probe, public, no auth needed:
const ping = await membber.systemPing({});
console.log(ping.data); // { ok: true, service: ..., version: ..., time: ... }
// A typed, authenticated read:
const { data, error } = await membber.raw.GET("/api/v1/loyalty/state", {
params: { query: { customer_id: "<customer-id>" } },
});
if (error) {
// error is the typed envelope: { error: { code, message, requestId } }
console.error(error.error.code, error.error.message);
} else {
console.log(data); // fully typed response body
}{ data, error } rather than throwing: exactly one of the two is set, and both are typed.membber.raw is the full typed client: GET, POST, PATCH and PUT against any contract path, with the compiler checking parameters and bodies against the same schemas shown in the reference.advanceOrderFulfilment, confirmOrder, createOrder, getCheckoutSettings, refundOrder, systemPing.import type { paths, operations, components } from "@membber/sdk-ts";
// Every path, operation and schema from the contract is exported:
type CreateOrderBody =
operations["createOrder"]["requestBody"]["content"]["application/json"];Send an Idempotency-Key header on writes via the headers option, as shown in every write operation's TypeScript example in the reference. The idempotency, errors and rate limits guides apply unchanged: the SDK adds types, not behaviour.