https://github.com/jiyamathias/monnify-go
Golang sdk for the Monnify api
https://github.com/jiyamathias/monnify-go
golang monnify monnify-go
Last synced: 6 months ago
JSON representation
Golang sdk for the Monnify api
- Host: GitHub
- URL: https://github.com/jiyamathias/monnify-go
- Owner: jiyamathias
- License: mit
- Created: 2022-07-19T13:50:46.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-06-05T14:31:43.000Z (about 1 year ago)
- Last Synced: 2026-01-15T00:58:55.387Z (6 months ago)
- Topics: golang, monnify, monnify-go
- Language: Go
- Homepage: https://developers.monnify.com/api
- Size: 2.56 MB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# monnify-go
Monnify-go is a Go library that allows you to integrate the MONNIFY payment gateway into your Go project.
# Please ensure to create issues in this repo if :
- You encounter any error while using this package and that issue would be attended to immediately.
# Get Started
- In other to use this package, you need to first create an account with monnify via https://app.monnify.com/create-account
- After your account have been successfully created, locate the developer option at the bottom left of your dashboard to get your:
1. Api key
2. Secret Key
3. Contract code
# Installation
To install this monnify package, you need to install [Go](https://golang.org/) and set your Go workspace first.
1. You can use the below Go command to install monnify-go
```sh
$ go get -u github.com/jiyamathias/monnify-go
```
2. Import it in your code:
```sh
import "github.com/jiyamathias/monnify-go"
```
## Note : All methods in this package returns three (3) things:
- [x] An object of the response
- [x] An error (if any)
# Quick start
```sh
# assume the following codes in example.go file
$ touch example.go
# open the just created example.go file in the text editor of your choice
```
## Accept Payment
Use this to accept payments from customers
### Use this object payload to implement the AcceptPayment() method
Note: CurrencyCode should be "NGN" for naira
```go
type AcceptPaymentReq struct {
PaymentReference string `json:"paymentReference"`
Amount int `json:"amount"`
CurrencyCode string `json:"currencyCode"`
ContractCode string `json:"contractCode"`
CustomerEmail string `json:"customerEmail"`
CustomerName string `json:"customerName"`
CustomerPhoneNumber string `json:"customerPhoneNumber"`
RedirectUrl string `json:"redirectUrl"`
PaymentDescription string `json:"paymentDescription"`
}
```
```go
package main
import (
"fmt"
"net/http"
monnify "github.com/jiyamathias/monnify-go"
)
func main() {
apiKey := ""
secretKey := ""
baseUrl := "https://sandbox.monnify.com" // for test
client := monnify.New(*http.DefaultClient, baseUrl,apiKey, secretKey)
payload := monnify.AcceptPaymentReq{}
res, err := client.AcceptPayment(payload)
if err != nil {
fmt.Println(err)
}
fmt.Println(res)
}
```
## Get Accepted Payment Status
Use this to get accepted payment status
```go
package main
import (
"fmt"
"net/http"
monnify "github.com/jiyamathias/monnify-go"
)
func main() {
apiKey := ""
secretKey := ""
baseUrl := "https://sandbox.monnify.com" // for test
client := monnify.New(*http.DefaultClient, baseUrl,apiKey, secretKey)
paymentReference := "ref123"
res, err := client.GetTransactionStatus(paymentReference)
if err != nil {
fmt.Println(err)
}
fmt.Println(res)
}
```