Skip to main content

Overview

The Bila TypeScript SDK provides a complete, type-safe client library for integrating Bila’s fintech services into your server-side applications.

Type-Safe

Full TypeScript support with comprehensive request and response types.

Promise-Based

Modern async/await API for clean, readable integration.

Comprehensive

Access to all Bila API features: Accounts, Transfers, Collections, and more.

Stainless Generated

Consistently structured and always up-to-date with the latest API changes.

Installation

Quick Start

API Classes

The SDK is organized into resources, each handling a specific domain:

Accounts

Manage your Bila wallets and check balances. Types: BilaResponse, AccountRetrieveResponse, AccountListResponse, AccountGetBalanceResponse

Methods

client.accounts.retrieve(id) Retrieve details for a specific account.
Returns: AccountRetrieveResponse client.accounts.list(params?) List all accounts associated with your profile.
Returns: AccountListResponse client.accounts.getBalance(id) Check the real-time balance of an account.
Returns: AccountGetBalanceResponse

TransferRecipients

Manage payout recipients for bank and mobile money transfers. Types: TransferRecipientRetrieveResponse, TransferRecipientListResponse, TransferRecipientCreateBankAccountResponse, TransferRecipientCreateMobileMoneyResponse

Methods

client.transferRecipients.retrieve(id) Retrieve details for a specific transfer recipient.
Returns: TransferRecipientRetrieveResponse client.transferRecipients.list(params?) List all transfer recipients.
Returns: TransferRecipientListResponse client.transferRecipients.createBankAccount(params) Create a new bank account transfer recipient.
Returns: TransferRecipientCreateBankAccountResponse client.transferRecipients.createMobileMoney(params) Create a new mobile money transfer recipient.
Returns: TransferRecipientCreateMobileMoneyResponse

Transfers

Send funds to bank accounts or mobile money wallets. Types: TransferRetrieveResponse, TransferListResponse, TransferGetStatusByReferenceResponse, TransferInitiateBankTransferResponse, TransferInitiateMobileMoneyTransferResponse

Methods

client.transfers.retrieve(id) Retrieve details for a specific transfer.
Returns: TransferRetrieveResponse client.transfers.list(params?) List all transfers.
Returns: TransferListResponse client.transfers.getStatusByReference(reference) Get the status of a transfer by its reference.
Returns: TransferGetStatusByReferenceResponse client.transfers.initiateBankTransfer(params) Initiate a bank transfer.
Returns: TransferInitiateBankTransferResponse client.transfers.initiateMobileMoneyTransfer(params) Initiate a mobile money transfer.
Returns: TransferInitiateMobileMoneyTransferResponse

Collections

Accept mobile money payments from customers. Types: CollectionRetrieveResponse, CollectionListResponse, CollectionGetStatusByReferenceResponse, CollectionInitiateMobileMoneyCollectionResponse

Methods

client.collections.retrieve(id) Retrieve details for a specific collection.
Returns: CollectionRetrieveResponse client.collections.list(params?) List all collections.
Returns: CollectionListResponse client.collections.getStatusByReference(reference) Get the status of a collection by its reference.
Returns: CollectionGetStatusByReferenceResponse client.collections.initiateMobileMoneyCollection(params) Initiate a mobile money collection.
Returns: CollectionInitiateMobileMoneyCollectionResponse

Transactions

View and manage transaction history. Types: TransactionRetrieveResponse, TransactionListResponse

Methods

client.transactions.retrieve(id) Retrieve details for a specific transaction.
Returns: TransactionRetrieveResponse client.transactions.list(params?) List all transactions.
Returns: TransactionListResponse

Webhooks

Configure endpoints to receive real-time event notifications. Types: WebhookCreateResponse, WebhookUpdateResponse, WebhookListResponse, WebhookGetDeliveriesResponse, WebhookListEventsResponse, WebhookRotateSecretResponse

Methods

client.webhooks.create(params) Register a new webhook endpoint.
Returns: WebhookCreateResponse client.webhooks.update(id, params) Update an existing webhook.
Returns: WebhookUpdateResponse client.webhooks.list() List all registered webhooks.
Returns: WebhookListResponse client.webhooks.deactivate(id) Deactivate a webhook.
Returns: BilaResponse client.webhooks.getDeliveries(id, params?) Get delivery history for a specific webhook.
Returns: WebhookGetDeliveriesResponse client.webhooks.listEvents() List all supported webhook events.
Returns: WebhookListEventsResponse client.webhooks.rotateSecret(id) Rotate the signing secret for a webhook.
Returns: WebhookRotateSecretResponse

Banks

Utilities for listing supported financial institutions. Types: BankListResponse

Methods

client.banks.list(params?) List supported banks for a specific country.
Returns: BankListResponse

Resolve

Utilities for verifying account details. Types: ResolveBankAccountResponse, ResolveMobileMoneyResponse

Methods

client.resolve.bankAccount(params) Verify the owner of a bank account.
Returns: ResolveBankAccountResponse client.resolve.mobileMoney(params) Verify mobile money details.
Returns: ResolveMobileMoneyResponse

Error Handling

When the library is unable to connect to the API, or if the API returns a non-success status code (4xx or 5xx), a subclass of APIError is thrown.
To handle a specific error, check the status code or use instanceof:

Type Definitions

Every API method has typed request params and responses. Types are available on the Bila namespace - only one import is needed:
Type names follow a simple pattern:

Best Practices

1

Secure Your Credentials

Always use environment variables or a secrets manager for API credentials. Never commit credentials to version control.
2

Implement Webhook Signature Verification

Always verify webhook signatures to ensure events are legitimately from Bila and haven’t been tampered with.
3

Handle Errors Gracefully

Implement proper error handling with retry logic for transient failures (5xx errors, rate limits).

Next Steps

SDK Quickstart

Complete integration guide with examples

Transfers

Learn about initiating transfers

Webhooks

Set up webhook notifications

API Reference

Complete REST API documentation