SDK

SDK overview

The Tab SDK wraps the REST API and the EIP-712 signing dance into a small TypeScript module. Use it from a Node backend, an edge function, or directly in the browser with a publishable key.

Install

npm install @tab/sdk
# or
pnpm add @tab/sdk

Server usage

import { Tab } from "@tab/sdk";

const tab = new Tab({ apiKey: process.env.TAB_SECRET_KEY! });

const order = await tab.orders.create({
  amount: "12.50",
  currency: "USDC",
  chain: "base",
  recipient: "@yourhandle",
  metadata: { order_id: "A-1042" },
});

console.log(order.checkout_url);

Verifying a webhook

import { verifyWebhook } from "@tab/sdk/webhooks";

export async function POST(req: Request) {
  const sig = req.headers.get("Tab-Signature")!;
  const body = await req.text();
  const event = verifyWebhook(body, sig, process.env.TAB_WEBHOOK_SECRET!);
  // event.type, event.data.order, ...
  return new Response("ok");
}

Client usage

import { TabBrowser } from "@tab/sdk/browser";

const tab = new TabBrowser({ publishableKey: "pk_..." });
await tab.checkout.open({ orderId: "ord_8H3kZ..." });

What the SDK does for you

  • Builds the EIP-712 domain and types from the deployed router metadata.
  • Computes the fee and the deadline.
  • Picks a fresh nonce that the router has not yet seen.
  • Drives the wallet popup or the invisible-wallet signer.
  • Posts the signed message to the relayer and surfaces the on-chain hash.

What you can still do yourself

Everything. The SDK is a convenience layer; if you want to talk to the router directly with viem or ethers, every type is documented in TabRouter and TabBotRouter.