Skip to content

NdoleStudio/afrikpay-go

Repository files navigation

afrikpay-go

Build codecov Scrutinizer Code Quality Go Report Card GitHub contributors GitHub license PkgGoDev

This package provides a Go client for the AfrikPay HTTP API https://developers.afrikpay.com/

Installation

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"

Implemented

  • 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

Usage

Initializing the Client

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 */),
  )
}

Error handling

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
}

Testing

You can run the unit tests for this client from the root directory using the command below:

go test -v

License

This project is licensed under the MIT License - see the LICENSE file for details

About

Unofficial go client for AfrikPay

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages