https://github.com/ndolestudio/orangemoney-go
Unofficial SDK for the Orange Money API
https://github.com/ndolestudio/orangemoney-go
orange-money orange-money-api orange-money-cameroon orange-money-core
Last synced: about 1 year ago
JSON representation
Unofficial SDK for the Orange Money API
- Host: GitHub
- URL: https://github.com/ndolestudio/orangemoney-go
- Owner: NdoleStudio
- License: mit
- Created: 2022-12-06T17:54:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-02T08:15:20.000Z (about 1 year ago)
- Last Synced: 2025-04-02T09:26:37.687Z (about 1 year ago)
- Topics: orange-money, orange-money-api, orange-money-cameroon, orange-money-core
- Language: Go
- Homepage:
- Size: 25.4 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# orangemoney-go
[](https://github.com/NdoleStudio/orangemoney-go/actions/workflows/main.yml)
[](https://codecov.io/gh/NdoleStudio/orangemoney-go)
[](https://scrutinizer-ci.com/g/NdoleStudio/orangemoney-go/?branch=main)
[](https://goreportcard.com/report/github.com/NdoleStudio/orangemoney-go)
[](https://github.com/NdoleStudio/orangemoney-go/graphs/contributors)
[](https://github.com/NdoleStudio/orangemoney-go/blob/master/LICENSE)
[](https://pkg.go.dev/github.com/NdoleStudio/orangemoney-go)
This package provides a generic `go` client for the Orange Money API
## Installation
`orangemoney-go` is compatible with modern Go releases in module mode, with Go installed:
```bash
go get github.com/NdoleStudio/orangemoney-go
```
Alternatively the same can be achieved if you use `import` in a package:
```go
import "github.com/NdoleStudio/orangemoney-go"
```
## Implemented
- **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 transaction
- `GET {baseURL}/omcoreapis/1.0.1/mp/pay`: Execute and initiated transaction
## Usage
### Initializing the Client
An instance of the client can be created using `New()`.
```go
package main
import (
"github.com/NdoleStudio/orangemoney-go"
)
func main() {
client := orangemoney.New(
orangemoney.WithUsername(""),
orangemoney.WithPassword(""),
orangemoney.WithAuthToken(""),
)
}
```
### Error handling
All API calls return an `error` as the last return object. All successful calls will return a `nil` error.
```go
status, response, err := client.MerchantPayment.Init(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