A Go client for the Chimoney API.
go get github.com/chimoney/chimoney-gopackage main
import (
"context"
"fmt"
"github.com/chimoney/chimoney-go"
)
func main() {
client := chimoney.New(
chimoney.WithAPIKey("your-api-key"),
chimoney.WithSandbox(true), // Use sandbox environment
)
ctx := context.Background()
// Get supported assets
assets, err := client.Info.GetSupportedAssets(ctx)
if err != nil {
panic(err)
}
fmt.Printf("Supported assets: %+v\n", assets)
}- Simple, idiomatic Go API
- Supports all Chimoney API endpoints
- Configurable HTTP client
- Sandbox mode support
- Context support for cancellation and timeouts
- Account: Account verification and management
- Info: System information and supported assets
- MobileMoney: Mobile money payments and transactions
- Payouts: Handle various payout methods
- Airtime
- Bank transfers
- Chimoney transfers
- Gift cards
- Crypto payments
- Redeem: Redeem and verify Chimoney transactions
- SubAccount: Manage sub-accounts
- Wallet: Wallet operations and transfers
momoReq := &mobilemoney.PaymentRequest{
Amount: 10,
Currency: "NGN",
PhoneNumber: "+2348123456789",
FullName: "John Doe",
Country: "Nigeria",
Email: "[email protected]",
TxRef: "tx123",
}
resp, err := client.MobileMoney.MakePayment(ctx, momoReq)airtimes := []payouts.AirtimePayload{
{
CountryToSend: "Nigeria",
PhoneNumber: "+2348123456789",
ValueInUSD: 3,
},
}
resp, err := client.Payouts.Airtime(ctx, airtimes, "")// Get wallet balance
balance, err := client.Wallet.GetBalance(ctx, "")
// List wallets
wallets, err := client.Wallet.List(ctx, "")
// Transfer funds
transfer, err := client.Wallet.Transfer(ctx, "receiver123", "wallet_type")The SDK includes comprehensive unit tests. To run all tests:
go test -v ./test/...Currently implemented test coverage:
✅ Account Module
- GetAllTransactions
- GetTransactionByID
- GetTransactionsByIssueID
- Transfer
- DeleteUnpaidTransaction
✅ Info Module
- GetSupportedAssets
- GetAirtimeCountries
- GetBanks
- GetLocalAmountInUSD
- GetMobileMoneyCodes
- GetUSDInLocalAmount
✅ MobileMoney Module
- MakePayment
- VerifyPayment
- GetAllTransactions
✅ Payouts Module
- Airtime
- Bank
- Chimoney
- GiftCard
- Status
✅ Redeem Module
- Airtime
- Any
- Chimoney
- GetChimoney
- GiftCard
- MobileMoney
✅ SubAccount Module
- Create
- List
- Delete
✅ Wallet Module
- GetBalance
- List
// Create sub-account
subAccReq := &subaccount.CreateRequest{
Name: "Test Account",
Email: "[email protected]",
}
subAcc, err := client.SubAccount.Create(ctx, subAccReq)
// List sub-accounts
subAccounts, err := client.SubAccount.List(ctx)Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.