Checkout SDK

@tineon/t9n reference

A small browser SDK that opens Slimepay's payment sheet. It creates the session, shows the deposit details, watches for payment and tells you what happened.

Initialize

checkout.ts
import { initializeT9n } from "@tineon/t9n";

const checkout = initializeT9n({
  publicKey: "pk_live_xxx",
  amountNgn: 35000,
  currencies: ["BTC", "ETH", "SOL", "USDT", "USDC"],
  customer: { email: "buyer@example.com", name: "Ada", reference: "order-123" },
  metadata: { cartId: "c_981" },
  hooks: {
    onStatusChange: (status) => console.log("status", status),
    onSuccess: ({ sessionId }) => console.log("paid", sessionId),
    onFail: ({ error }) => console.error(error),
  },
});

Options are validated when you call initializeT9n; a bad option throws straight away.

publicKeyrequired

string

Your pk_live_ key from the dashboard.
amountNgnrequired

number

Order total in naira. Must be above zero.
currenciesrequired

string[]

Coins the customer can choose from, up to 16, no duplicates. USDT and USDC expand into one option per network.
customerrequired

{ email, name?, reference? }

Email is required. Use reference for your order ID; you can verify by it later.
metadata

Record<string, any>

Anything you want stored with the session.
hooks

object

Lifecycle callbacks, listed below.
button

{ text?, theme?, className?, style? }

Defaults for mountButton and createButton. Themes: solid, light, outline.
requestTimeoutMs

number

Per-request timeout, 3000 to 30000. Defaults to 12000.
pollIntervalMs

number

How often the open sheet checks for payment, 3000 to 15000. Defaults to 5000.
apiBaseUrl

string

Only for testing against your own server. Must be https, or http on localhost.

Open the checkout

Trigger
// Slimepay's own button, styled with a theme
checkout.mountButton("#pay", { text: "Pay now", theme: "solid" });

// Your button, any event
const detach = checkout.bindTrigger("#custom-pay", "click");

// Or open directly
await checkout.open();

A session is created when the sheet opens, not when the button is mounted, so rendering buttons is free. Closing the sheet before paying marks that session closed; opening again starts a new one.

Hooks

onOpen

() => void

The sheet is opening.
onSessionCreated

({ sessionId, expiresAt }) => void

Save sessionId if you want to verify by it.
onCurrencySelected

({ currency, network, depositAddress, expectedAmountCrypto }) => void

The customer picked a coin and got deposit details.
onStatusChange

(status) => void

Every status change, see the table below.
onSuccess

({ sessionId, status }) => void

Payment confirmed. Fires once per session.
onFail

({ sessionId?, error }) => void

The session expired, failed or could not open. Fires once.
onClose

() => void

The sheet closed for any reason.

Payment statuses

created

server

Session exists, no coin chosen yet.
awaiting_payment

server

Coin chosen and deposit address shown.
pending_confirmation

check result

Checked, but the full amount hasn't arrived yet. Not stored; ask again later.
settled

server

Full amount received. Payout to your bank starts automatically.
expired

server

15 minutes passed without full payment.
failed

server

The checkout gave up after a failed check.
closed

server

The customer closed the sheet before paying.

Verify before you fulfil

Hooks run in the customer's browser and can be faked. Before you release goods, check the status with verifyT9nTransaction or checkout.verifyTransaction. Calling it on a session that is waiting for payment also runs a fresh on-chain check.

verify.ts
import { verifyT9nTransaction } from "@tineon/t9n";

const result = await verifyT9nTransaction(
  { publicKey: "pk_live_xxx" },
  { sessionId: "cs_..." } // or { reference: "order-123" }
);
// result.status, result.selectedCurrency, result.expectedAmountCrypto, result.settledAt ...

Send the exact amount

The sheet tells customers the exact amount and network. Paying less, or on another network, will not settle the session.