This package provides a generic go client for the Orange Money API
orangemoney-go is compatible with modern Go releases in module mode, with Go installed:
go get github.com/NdoleStudio/orangemoney-goAlternatively the same can be achieved if you use import in a package:
import "github.com/NdoleStudio/orangemoney-go"- Token
POST {baseURL}/token: Get Access Token
- Merchant Payments
POST {baseURL}/omcoreapis/1.0.2/mp/init: Generate pay token.GET {baseURL}/omcoreapis/1.0.2/mp/push/{payToken}: Push payment notification.GET {baseURL}/omcoreapis/1.0.2/mp/paymentstatus/{payToken}: Get the status of a transactionGET {baseURL}/omcoreapis/1.0.1/mp/pay: Execute and initiated transaction
An instance of the client can be created using New().
package main
import (
"github.com/NdoleStudio/orangemoney-go"
)
func main() {
client := orangemoney.New(
orangemoney.WithUsername(""),
orangemoney.WithPassword(""),
orangemoney.WithAuthToken(""),
)
}All API calls return an error as the last return object. All successful calls will return a nil error.
status, response, err := client.MerchantPayment.Init(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 -vThis project is licensed under the MIT License - see the LICENSE file for details
