Docs
TypeScript SDK
A small server-side client for checkout sessions, verify and fee quotes. Copy sdk/ from the Steadi Pay repo into your app, or call the HTTP API directly.
Install
The SDK lives at sdk/index.ts in the Steadi Pay repository. It has no extra runtime dependencies beyond fetch. Point baseUrl at https://api.steadipay.ltd in production.
import { SteadiPay } from "./steadipay";
const steadi = new SteadiPay({
apiKey: process.env.STEADIPAY_SECRET_KEY!,
baseUrl: "https://api.steadipay.ltd",
});Create a checkout
const session = await steadi.checkoutSessions.create({
amount: "250",
merchant_reference: "TICKET-8841",
return_url: "https://tickets.example/orders/8841/return",
description: "Saturday show",
});
return Response.redirect(session.checkout_url);Each SDK write sends a fresh Idempotency-Key. Currency is always MWK. See Checkout for the rest of the fields if you call HTTP yourself.
Verify
const payment = await steadi.payments.verify("pay_...");
if (payment.status === "succeeded") {
// fulfil the order
}Quote a fee
const quote = await steadi.fees.quote({
amount: "250",
method: "mobile_money",
});
// quote.customer_pays_minor / quote.merchant_receives_minorErrors
Failed responses throw Error with the API message. Handle error codes yourself if you need to branch.