Overview
The Bila Go library provides convenient access to the Bila REST API from applications written in Go.Idiomatic Go
Functional options pattern and context-aware methods throughout.
Strongly Typed
Typed request params and response structs for every endpoint.
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:| Resource | Description |
|---|---|
| Accounts | Retrieve accounts, list accounts, and check balances |
| TransferRecipients | Manage payout recipients for bank and mobile money transfers |
| Transfers | Send payouts via bank transfer and mobile money |
| Collections | Collect payments via mobile money |
| Transactions | Retrieve and list transaction history |
| Webhooks | Configure webhooks and manage delivery history |
| Banks | List supported banks and financial institutions |
| Resolve | Verify bank account and mobile money details |
Accounts
Manage your Bila wallets and check balances.Methods
client.Accounts.Get(ctx, id)
Retrieve details for a specific account.
*bila.AccountRetrieveResponse
client.Accounts.List(ctx, params)
List all accounts associated with your profile.
*bila.AccountListResponse
client.Accounts.GetBalance(ctx, id)
Check the real-time balance of an account.
*bila.AccountGetBalanceResponse
TransferRecipients
Manage payout recipients for bank and mobile money transfers.Methods
client.TransferRecipients.Get(ctx, id)
Retrieve details for a specific transfer recipient.
*bila.TransferRecipientRetrieveResponse
client.TransferRecipients.List(ctx, params)
List all transfer recipients.
*bila.TransferRecipientListResponse
client.TransferRecipients.NewBankAccount(ctx, params)
Create a new bank account transfer recipient.
*bila.TransferRecipientCreateBankAccountResponse
client.TransferRecipients.NewMobileMoney(ctx, params)
Create a new mobile money transfer recipient.
*bila.TransferRecipientCreateMobileMoneyResponse
Transfers
Send funds to bank accounts or mobile money wallets.Methods
client.Transfers.Get(ctx, id)
Retrieve details for a specific transfer.
*bila.TransferRetrieveResponse
client.Transfers.List(ctx, params)
List all transfers.
*bila.TransferListResponse
client.Transfers.GetStatusByReference(ctx, reference)
Get the status of a transfer by its reference.
*bila.TransferGetStatusByReferenceResponse
client.Transfers.NewBankTransfer(ctx, params)
Initiate a bank transfer.
*bila.TransferInitiateBankTransferResponse
client.Transfers.NewMobileMoneyTransfer(ctx, params)
Initiate a mobile money transfer.
*bila.TransferInitiateMobileMoneyTransferResponse
Collections
Accept mobile money payments from customers.Methods
client.Collections.Get(ctx, id)
Retrieve details for a specific collection.
*bila.CollectionRetrieveResponse
client.Collections.List(ctx, params)
List all collections.
*bila.CollectionListResponse
client.Collections.GetStatusByReference(ctx, reference)
Get the status of a collection by its reference.
*bila.CollectionGetStatusByReferenceResponse
client.Collections.NewMobileMoneyCollection(ctx, params)
Initiate a mobile money collection.
*bila.CollectionInitiateMobileMoneyCollectionResponse
Transactions
View and manage transaction history.Methods
client.Transactions.Get(ctx, id)
Retrieve details for a specific transaction.
*bila.TransactionRetrieveResponse
client.Transactions.List(ctx, params)
List all transactions.
*bila.TransactionListResponse
Webhooks
Configure endpoints to receive real-time event notifications.Methods
client.Webhooks.New(ctx, params)
Register a new webhook endpoint.
*bila.WebhookCreateResponse
client.Webhooks.Update(ctx, id, params)
Update an existing webhook.
*bila.WebhookUpdateResponse
client.Webhooks.List(ctx)
List all registered webhooks.
*bila.WebhookListResponse
client.Webhooks.Deactivate(ctx, id)
Deactivate a webhook.
*bila.BilaResponse
client.Webhooks.GetDeliveries(ctx, id, params)
Get delivery history for a specific webhook.
*bila.WebhookGetDeliveriesResponse
client.Webhooks.ListEvents(ctx)
List all supported webhook events.
*bila.WebhookListEventsResponse
client.Webhooks.RotateSecret(ctx, id)
Rotate the signing secret for a webhook.
*bila.WebhookRotateSecretResponse
Banks
Utilities for listing supported financial institutions.Methods
client.Banks.List(ctx, params)
List supported banks for a specific country.
*bila.BankListResponse
Resolve
Utilities for verifying account details.Methods
client.Resolve.BankAccount(ctx, params)
Verify the owner of a bank account.
*bila.ResolveBankAccountResponse
client.Resolve.MobileMoney(ctx, params)
Verify mobile money details.
*bila.ResolveMobileMoneyResponse
Error Handling
When the API returns a non-success status code, the SDK returns an error of type*bila.Error. This contains StatusCode, *http.Request, and *http.Response values, as well as the JSON of the error body.
Type Definitions
Request fields useomitzero semantics. Required primitive fields are tagged api:"required" and always serialized. Optional fields are wrapped in param.Opt[T] and set with constructors like bila.String(string), bila.Float(float64), and bila.Bool(bool).
JSON field with metadata about each property, including a .Valid() method to check if a field is present and non-null.
Best Practices
Use Environment Variables
Configure your API key via the
BILA_API_KEY environment variable rather than hardcoding it. option.WithAPIKey will use this by default if no key is passed explicitly.Always Pass a Context
Use
context.Context to control timeouts and cancellation on every request, especially for long-running batch operations.Handle Errors with errors.As
Use the
errors.As pattern to unwrap *bila.Error and inspect the status code and response body for failed requests.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
