Skip to content

Chimoney/chimoney-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chimoney Go SDK

A Go client for the Chimoney API.

Installation

go get github.com/chimoney/chimoney-go

Usage

package 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)
}

Features

  • Simple, idiomatic Go API
  • Supports all Chimoney API endpoints
  • Configurable HTTP client
  • Sandbox mode support
  • Context support for cancellation and timeouts

Modules

  • 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

Examples

Mobile Money Payment

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)

Airtime Payout

airtimes := []payouts.AirtimePayload{
    {
        CountryToSend: "Nigeria",
        PhoneNumber:   "+2348123456789",
        ValueInUSD:    3,
    },
}
resp, err := client.Payouts.Airtime(ctx, airtimes, "")

Wallet Operations

// 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")

Testing

The SDK includes comprehensive unit tests. To run all tests:

go test -v ./test/...

Test Coverage

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

Sub-Account Management

// 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)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

Go library for Chimoney's API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages