Functions Quick Reference
A master index of all core functions and client-side utilities exposed by the official SettleSettle SDK. Use this directory to quickly check return types and understand what methods to call for various integration milestones.
Global Overview Table
| Function / Method | SDK Module | Expected Output | Operational Objective | Action Classification |
|---|---|---|---|---|
settle.users.sync(data) | Users | Promise<AppUser> | Syncs end-user details to SettleSettle user directory for auditing and historical ledger lookup. | Onboarding |
settle.payments.initialize(data) | Payments | Promise<PaymentInit> | Provisions dynamic payment links and initiates transactional intent nodes. | Monetization |
settle.payments.verify(ref) | Payments | Promise<Payment> | Connects to core networks to confirm completion of payment events. | Monetization |
settle.wallet.getBalance(id) | Wallet | Promise<Balance> | Queries the system ledger for user virtual credit tallies and equivalent fiat value. | Audit |
settle.wallet.credit(id, data) | Wallet | Promise<Wallet> | Directly programmatically injects free, promotional, or custom credits to an account. | Billing |
settle.wallet.debit(id, data) | Wallet | Promise<Wallet> | Atomically consumes credits for programmatic system tasks (API calls, queries, downloads). | Billing |
settle.wallet.getHistory(id) | Wallet | Promise<History[]> | Enumerates real-time transaction logs, charge statements, and audit trails. | Audit |
settle.wallet.recordAdReward(id) | Wallet | Promise<Wallet> | Captures completed video-ad engagement and dispenses custom virtual reward allocations. | Engagement |
settle.billing.bootstrap() | Billing | Promise<Billing> | Hydrates client environments with global layout tokens, rulesheets, and gateway parameters. | Lifecycle |
settle.billing.recordInlineAdReward(id) | Billing | Promise<Reward> | Authorizes and allocates dynamic inline user credits via standard web monetization gates. | Engagement |
settle.events.track(event) | Events | Promise<Ack> | Fires non-blocking usage telemetry to run automatic, server-side event-based pricing rules. | Tracking |
settle.events.getSummary(id) | Events | Promise<Summary> | Compiles telemetry streams into aggregated app-level velocity analytics. | Analytics |
settle.auth.checkCredentials() | Auth | Promise<boolean> | Runs connectivity checks validating that current API key tokens are active and routed. | Core |
settle.shutdown() | Core | Promise<void> | Flushes background queues securely and releases connection memory buffers. | Lifecycle |
Implementation Insights
#### 📡 Non-Blocking Event Tracking
Calling settle.events.track() queues telemetry locally and fires asynchronously. It does not impact your API response times, ensuring zero overhead for app users.
// Fire-and-forget. The SDK processes this in the background.
settle.events.track({
userId: "user_456",
eventType: "AI_QUERY"
});#### 🏦 Monetary Consistency
Always remember that the SDK, API, and Webhooks expect financial numeric parameters in Kobo (100 kobo = ₦1.00) to prevent floating-point rounding discrepancies.
#### 🧼 Clean Disconnections
When running on serverless environments (AWS Lambda, Vercel) or process lifecycles (PM2), invoke settle.shutdown() upon application close to prevent unhandled async event loss.
process.on('SIGTERM', async () => {
console.log('Cleaning down connections...');
await settle.shutdown();
});