paytrack docs
SDKs
Use the JavaScript/TypeScript SDK foundation for typed paytrack integrations.
JavaScript and TypeScript
The SDK foundation lives in sdk/javascript. It is prepared for npm publishing as @paytrack/sdk. Until it is published, treat the install command as the target public package name.
Example
npm install @paytrack/sdk
Initialization
Example
import { PaytrackClient } from "@paytrack/sdk";
const paytrack = new PaytrackClient({
apiKey: process.env.PAYTRACK_API_KEY,
baseUrl: "https://paytrack.ng/api/v1",
timeoutMs: 10000,
retries: 2,
});Create customer
Example
const customer = await paytrack.customers.create({
name: "ABC Furniture",
phone: "+2348012345678",
email: "finance@example.com",
});Create track
Example
const track = await paytrack.tracks.create({
customerId: customer.id,
title: "Samsung TV installment",
amount: 420000,
currency: "NGN",
installments: 12,
});Record payment and send reminder
Example
await paytrack.payments.create({
trackId: track.id,
amount: 25000,
method: "bank_transfer",
});
await paytrack.reminders.send({
trackId: track.id,
channel: "sms",
message: "Your installment payment is due today.",
});Fetch report and handle errors
Example
try {
const report = await paytrack.reports.summary({
from: "2026-07-01",
to: "2026-07-31",
});
console.log(report.data);
} catch (error) {
console.error(error.requestId, error.statusCode, error.message);
}Retry behavior and test mode
The SDK should retry safe transient failures with backoff, preserve request IDs, and never retry validation errors. Use ptrk_test_ keys while building and ptrk_live_ keys only after production review.
Coming soon
PHP, Python, and Go SDKs should be added after the JavaScript SDK is published and the API shape stabilizes.
