Skip to main content

Overview

The Bila C# SDK provides convenient access to the Bila REST API from applications written in C#. It is generated with Stainless.

Strongly Typed

Typed request and response models for every endpoint.

Async Methods

Every method returns a Task, following standard .NET async conventions.

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

Install the package from NuGet:
This library requires .NET Standard 2.0 or later.

Quick Start

Configure the client using environment variables, so you don’t need to pass ApiKey explicitly:

API Classes

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

Accounts

Manage your Bila wallets and check balances.

Methods

client.Accounts.Retrieve(id) Retrieve details for a specific account.
Returns: Task<AccountRetrieveResponse> client.Accounts.List(params) List all accounts associated with your profile.
Returns: Task<AccountListResponse> client.Accounts.GetBalance(id) Check the real-time balance of an account.
Returns: Task<AccountGetBalanceResponse>

TransferRecipients

Manage payout recipients for bank and mobile money transfers.

Methods

client.TransferRecipients.Retrieve(id) Retrieve details for a specific transfer recipient.
Returns: Task<TransferRecipientRetrieveResponse> client.TransferRecipients.List(params) List all transfer recipients.
Returns: Task<TransferRecipientListResponse> client.TransferRecipients.CreateBankAccount(params) Create a new bank account transfer recipient.
Returns: Task<TransferRecipientCreateBankAccountResponse> client.TransferRecipients.CreateMobileMoney(params) Create a new mobile money transfer recipient. This uses the resource-specific TransferRecipientCreateMobileMoneyParamsCountry enum rather than the shared Country enum.
Returns: Task<TransferRecipientCreateMobileMoneyResponse>

Transfers

Send funds to bank accounts or mobile money wallets.

Methods

client.Transfers.Retrieve(id) Retrieve details for a specific transfer.
Returns: Task<TransferRetrieveResponse> client.Transfers.List(params) List all transfers.
Returns: Task<TransferListResponse> client.Transfers.GetStatusByReference(reference) Get the status of a transfer by its reference.
Returns: Task<TransferGetStatusByReferenceResponse> client.Transfers.InitiateBankTransfer(params) Initiate a bank transfer.
Returns: Task<TransferInitiateBankTransferResponse> client.Transfers.InitiateMobileMoneyTransfer(params) Initiate a mobile money transfer.
Returns: Task<TransferInitiateMobileMoneyTransferResponse>

Collections

Accept mobile money payments from customers.

Methods

client.Collections.Retrieve(id) Retrieve details for a specific collection.
Returns: Task<CollectionRetrieveResponse> client.Collections.List(params) List all collections.
Returns: Task<CollectionListResponse> client.Collections.GetStatusByReference(reference) Get the status of a collection by its reference.
Returns: Task<CollectionGetStatusByReferenceResponse> client.Collections.InitiateMobileMoneyCollection(params) Initiate a mobile money collection. Use the Country, Operator, and Bearer constants rather than raw strings.
Returns: Task<CollectionInitiateMobileMoneyCollectionResponse>

Transactions

View and manage transaction history.

Methods

client.Transactions.Retrieve(id) Retrieve details for a specific transaction.
Returns: Task<TransactionRetrieveResponse> client.Transactions.List(params) List all transactions.
Returns: Task<TransactionListResponse>

Webhooks

Configure endpoints to receive real-time event notifications.

Methods

client.Webhooks.Create(params) Register a new webhook endpoint. Note the field is UrlValue, and events use the Event enum.
Returns: Task<WebhookCreateResponse> client.Webhooks.Update(id, params) Update an existing webhook.
Returns: Task<WebhookUpdateResponse> client.Webhooks.List() List all registered webhooks.
Returns: Task<WebhookListResponse> client.Webhooks.Deactivate(id) Deactivate a webhook.
Returns: Task<WebhookDeactivateResponse> client.Webhooks.GetDeliveries(id, params) Get delivery history for a specific webhook.
Returns: Task<WebhookGetDeliveriesResponse> client.Webhooks.ListEvents() List all supported webhook events.
Returns: Task<WebhookListEventsResponse> client.Webhooks.RotateSecret(id) Rotate the signing secret for a webhook.
Returns: Task<WebhookRotateSecretResponse>

Banks

Utilities for listing supported financial institutions.

Methods

client.Banks.List(params) List supported banks for a specific country. Note this resource takes a plain string for Country, unlike Transfers, Collections, and Resolve.
Returns: Task<BankListResponse>

Resolve

Utilities for verifying account details.

Methods

client.Resolve.BankAccount(params) Verify the owner of a bank account.
Returns: Task<ResolveBankAccountResponse> client.Resolve.MobileMoney(params) Verify mobile money details. This uses the resource-specific ResolveMobileMoneyParamsCountry enum rather than the shared Country enum.
Returns: Task<ResolveMobileMoneyResponse>

Raw Responses

The SDK defines methods that deserialize responses into instances of C# classes. To access response headers, status code, or the raw body, prefix any call with WithRawResponse:

Error Handling

The SDK throws custom unchecked exception types. BilaApiException is the base class for API errors:
All 4xx errors inherit from Bila4xxException. BilaIOException is thrown for I/O networking errors, and BilaInvalidDataException for failures interpreting parsed data.

Best Practices

1

Use Environment Variables

Configure the client with no arguments to use BILA_API_KEY and BILA_BASE_URL automatically, rather than hardcoding credentials.
2

Check Which Resources Use Constants

Country, Operator, Bearer, Status, and Event constants are used for Transfers, Collections, TransferRecipients, Resolve, and Webhooks. Banks is the exception - its Country field takes a plain string. Some resources also define their own scoped country enum (e.g. ResolveMobileMoneyParamsCountry, TransferRecipientCreateMobileMoneyParamsCountry) rather than reusing the shared Country enum, so check the specific params class.
3

Reuse the Client

Create a single BilaClient instance and reuse it across requests, or use WithOptions to temporarily override settings without creating a new client.
4

Handle Errors Gracefully

Catch BilaApiException separately from generic exceptions to distinguish API-level errors from network failures.

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