This package provides a Go client for the AfrikPay HTTP API https://developers.afrikpay.com/
afrikpay-go
is compatible with modern Go releases in module mode, with Go installed:
go get github.com/NdoleStudio/afrikpay-go
Alternatively the same can be achieved if you use import
in a package:
import "github.com/NdoleStudio/afrikpay-go"
- Balance:
POST /api/oss/balance/partner/v1
: Returns deposit and commission balance of the user
- Payment:
POST /api/oss/payment/partner/v1
: Make a payment (airtime, bill, taxes, school)
- Transaction Status:
POST /api/oss/transaction/status/partner/v1
: Get status of specific transaction
An instance of the client can be created using New()
.
package main
import (
"github.com/NdoleStudio/afrikpay-go"
)
func main() {
client := afrikpay.New(
afrikpay.WithAPIKey(""/* api key */),
afrikpay.WithWalletUsername(""/* wallet username */),
afrikpay.WithWalletPassword(""/* wallet username */),
afrikpay.WithWalletPin(""/* wallet pin */),
)
}
All API calls return an error
as the last return object. All successful calls will return a nil
error.
balance, response, err := client.Balance(context.Background())
if err != nil {
// handle error
}
You can run the unit tests for this client from the root directory using the command below:
go test -v
This project is licensed under the MIT License - see the LICENSE file for details