Console โ†’
SDK Reference

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 / MethodSDK ModuleExpected OutputOperational ObjectiveAction Classification
settle.users.sync(data)UsersPromise<AppUser>Syncs end-user details to SettleSettle user directory for auditing and historical ledger lookup.Onboarding
settle.payments.initialize(data)PaymentsPromise<PaymentInit>Provisions dynamic payment links and initiates transactional intent nodes.Monetization
settle.payments.verify(ref)PaymentsPromise<Payment>Connects to core networks to confirm completion of payment events.Monetization
settle.wallet.getBalance(id)WalletPromise<Balance>Queries the system ledger for user virtual credit tallies and equivalent fiat value.Audit
settle.wallet.credit(id, data)WalletPromise<Wallet>Directly programmatically injects free, promotional, or custom credits to an account.Billing
settle.wallet.debit(id, data)WalletPromise<Wallet>Atomically consumes credits for programmatic system tasks (API calls, queries, downloads).Billing
settle.wallet.getHistory(id)WalletPromise<History[]>Enumerates real-time transaction logs, charge statements, and audit trails.Audit
settle.wallet.recordAdReward(id)WalletPromise<Wallet>Captures completed video-ad engagement and dispenses custom virtual reward allocations.Engagement
settle.billing.bootstrap()BillingPromise<Billing>Hydrates client environments with global layout tokens, rulesheets, and gateway parameters.Lifecycle
settle.billing.recordInlineAdReward(id)BillingPromise<Reward>Authorizes and allocates dynamic inline user credits via standard web monetization gates.Engagement
settle.events.track(event)EventsPromise<Ack>Fires non-blocking usage telemetry to run automatic, server-side event-based pricing rules.Tracking
settle.events.getSummary(id)EventsPromise<Summary>Compiles telemetry streams into aggregated app-level velocity analytics.Analytics
settle.auth.checkCredentials()AuthPromise<boolean>Runs connectivity checks validating that current API key tokens are active and routed.Core
settle.shutdown()CorePromise<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.

typescript
// 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.

typescript
process.on('SIGTERM', async () => {
  console.log('Cleaning down connections...');
  await settle.shutdown();
});