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:Quick Start
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.
Task<AccountRetrieveResponse>
client.Accounts.List(params)
List all accounts associated with your profile.
Task<AccountListResponse>
client.Accounts.GetBalance(id)
Check the real-time balance of an account.
Task<AccountGetBalanceResponse>
TransferRecipients
Manage payout recipients for bank and mobile money transfers.Methods
client.TransferRecipients.Retrieve(id)
Retrieve details for a specific transfer recipient.
Task<TransferRecipientRetrieveResponse>
client.TransferRecipients.List(params)
List all transfer recipients.
Task<TransferRecipientListResponse>
client.TransferRecipients.CreateBankAccount(params)
Create a new bank account transfer recipient.
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.
Task<TransferRecipientCreateMobileMoneyResponse>
Transfers
Send funds to bank accounts or mobile money wallets.Methods
client.Transfers.Retrieve(id)
Retrieve details for a specific transfer.
Task<TransferRetrieveResponse>
client.Transfers.List(params)
List all transfers.
Task<TransferListResponse>
client.Transfers.GetStatusByReference(reference)
Get the status of a transfer by its reference.
Task<TransferGetStatusByReferenceResponse>
client.Transfers.InitiateBankTransfer(params)
Initiate a bank transfer.
Task<TransferInitiateBankTransferResponse>
client.Transfers.InitiateMobileMoneyTransfer(params)
Initiate a mobile money transfer.
Task<TransferInitiateMobileMoneyTransferResponse>
Collections
Accept mobile money payments from customers.Methods
client.Collections.Retrieve(id)
Retrieve details for a specific collection.
Task<CollectionRetrieveResponse>
client.Collections.List(params)
List all collections.
Task<CollectionListResponse>
client.Collections.GetStatusByReference(reference)
Get the status of a collection by its reference.
Task<CollectionGetStatusByReferenceResponse>
client.Collections.InitiateMobileMoneyCollection(params)
Initiate a mobile money collection. Use the Country, Operator, and Bearer constants rather than raw strings.
Task<CollectionInitiateMobileMoneyCollectionResponse>
Transactions
View and manage transaction history.Methods
client.Transactions.Retrieve(id)
Retrieve details for a specific transaction.
Task<TransactionRetrieveResponse>
client.Transactions.List(params)
List all transactions.
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.
Task<WebhookCreateResponse>
client.Webhooks.Update(id, params)
Update an existing webhook.
Task<WebhookUpdateResponse>
client.Webhooks.List()
List all registered webhooks.
Task<WebhookListResponse>
client.Webhooks.Deactivate(id)
Deactivate a webhook.
Task<WebhookDeactivateResponse>
client.Webhooks.GetDeliveries(id, params)
Get delivery history for a specific webhook.
Task<WebhookGetDeliveriesResponse>
client.Webhooks.ListEvents()
List all supported webhook events.
Task<WebhookListEventsResponse>
client.Webhooks.RotateSecret(id)
Rotate the signing secret for a webhook.
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.
Task<BankListResponse>
Resolve
Utilities for verifying account details.Methods
client.Resolve.BankAccount(params)
Verify the owner of a bank account.
Task<ResolveBankAccountResponse>
client.Resolve.MobileMoney(params)
Verify mobile money details. This uses the resource-specific ResolveMobileMoneyParamsCountry enum rather than the shared Country enum.
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 withWithRawResponse:
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
