Skip to content

NdoleStudio/smobilpay-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smobilpay Go SDK

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

This package provides an unofficial go client for the Smobilpay API

Installation

smobilpay-go is compatible with modern Go releases in module mode, with Go installed:

go get github.com/NdoleStudio/smobilpay-go

Alternatively the same can be achieved if you use import in a package:

import "github.com/NdoleStudio/smobilpay-go"

Implemented

  • Client
    • GET /ping: API Healthcheck endpoint
    • GET /verifytx: Get the current collection status
    • GET /historystd: Get the transaction history
    • POST /quotestd: Initializes a transaction
    • POST /collectstd: Confirms a transaction
  • Bill
    • GET /bill: Get details of a bill
  • Topup
    • GET /topup: Get available topup packages.
  • Cashin
    • GET /cashin: Get cashin pay item.
  • Cashout
    • GET /cashout: Get Cashout pay item.
  • Product
    • GET /product: Get product pay items.

Usage

Initializing the Client

An instance of the client can be created using New().

package main

import (
    "github.com/NdoleStudio/smobilpay-go"
)

func main()  {
    client := smobilpay.New(
        smobilpay.WithAccessToken(accessToken),
        smobilpay.WithAccessSecret(accessSecret),
    )
}

Error handling

All API calls return an error as the last return object. All successful calls will return a nil error.

status, response, err := client.Ping(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