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
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.
publicKeyrequiredstring
amountNgnrequirednumber
currenciesrequiredstring[]
customerrequired{ email, name?, reference? }
metadataRecord<string, any>
hooksobject
button{ text?, theme?, className?, style? }
requestTimeoutMsnumber
pollIntervalMsnumber
apiBaseUrlstring
Open the checkout
// 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
onSessionCreated({ sessionId, expiresAt }) => void
onCurrencySelected({ currency, network, depositAddress, expectedAmountCrypto }) => void
onStatusChange(status) => void
onSuccess({ sessionId, status }) => void
onFail({ sessionId?, error }) => void
onClose() => void
Payment statuses
createdserver
awaiting_paymentserver
pending_confirmationcheck result
settledserver
expiredserver
failedserver
closedserver
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.
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