https://github.com/ndolestudio/afrikpay-go
Unofficial go client for AfrikPay
https://github.com/ndolestudio/afrikpay-go
Last synced: about 2 months ago
JSON representation
Unofficial go client for AfrikPay
- Host: GitHub
- URL: https://github.com/ndolestudio/afrikpay-go
- Owner: NdoleStudio
- License: mit
- Created: 2022-03-17T17:04:10.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-08-30T13:56:00.000Z (almost 3 years ago)
- Last Synced: 2025-02-02T15:54:18.363Z (over 1 year ago)
- Language: Go
- Homepage: https://developer.afrikpay.com/
- Size: 58.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# afrikpay-go
[](https://github.com/NdoleStudio/afrikpay-go/actions/workflows/main.yml)
[](https://codecov.io/gh/NdoleStudio/afrikpay-go)
[](https://scrutinizer-ci.com/g/NdoleStudio/afrikpay-go/?branch=main)
[](https://goreportcard.com/report/github.com/NdoleStudio/afrikpay-go)
[](https://github.com/NdoleStudio/afrikpay-go/graphs/contributors)
[](https://github.com/NdoleStudio/afrikpay-go/blob/master/LICENSE)
[](https://pkg.go.dev/github.com/NdoleStudio/afrikpay-go)
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:
```bash
go get github.com/NdoleStudio/afrikpay-go
```
Alternatively the same can be achieved if you use `import` in a package:
```go
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
- **Cash In**:
- `POST /api/oss/cashin/partner/v1`: Perform a cash in operation
- **Option**:
- `POST /api/oss/option/partner/v1`: Get payment options for a service e.g. CANAL+
## Usage
### Initializing the Client
An instance of the client can be created using `New()`.
```go
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.
```go
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:
```bash
go test -v
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details