import { initializeT9n } from "@tineon/t9n";
const checkout = initializeT9n({
publicKey: "pk_live_xxx",
amountNgn: 35000,
currencies: ["BTC", "ETH", "TRX"],
customer: { email: "buyer@example.com", name: "Ada", reference: "order-123" },
metadata: { orderId: "order-123" },
hooks: {
onOpen: () => console.log("opened"),
onStatusChange: (status) => console.log("status", status),
onSuccess: ({ sessionId, status }) => console.log("paid", sessionId, status),
onFail: ({ error }) => console.error("failed", error),
onClose: () => console.log("closed"),
},
});Slimepay Merchant SDK
Everything you need to accept crypto from customers and settle in Naira directly into your recipient accounts with a single integration.
Embed injected checkout with real-time callbacks
Slimepay provides an injected checkout that can be mounted inline or opened as a modal. Use event handlers to sync your UI while checkout runs.
// Mount a button to a container
checkout.mountButton("#slimepay-checkout", { text: "Pay now", theme: "solid" });
// Or open as a modal
checkout.open();Session handling
The SDK creates a checkout session when you call checkout.open(). Mounting a button only renders a trigger, it does not create a session. Each session remains active for a limited window (as returned by the API). During this period, the wallet address is monitored for an incoming deposit that matches the expected payment details. If a valid deposit is detected before the session expires, the transaction is labeled as successful. If no matching deposit is confirmed before expiry, the session is marked as failed.
Verify a transaction
Use the verification helper to confirm a transaction by sessionId or reference. This is safe to call with your public key.
import { verifyT9nTransaction } from "@tineon/t9n";
const result = await verifyT9nTransaction(
{ publicKey: "pk_live_xxx" },
{ sessionId: "session_123" } // or { reference: "order-123" }
);
console.log("verified", result.status);Possible status values returned by verification:
- created — session created, currency not selected yet.
- awaiting_payment — currency selected, address issued, waiting for deposit.
- pending_confirmation — verification attempted, no matching deposit yet.
- settled — deposit confirmed and settlement initiated.
- expired — session timed out before payment.
- failed — session explicitly marked failed.
- closed — session closed before completion.