Categorygithub.com/almubarok/canopusgo
repositorypackage
1.0.3
Repository: https://github.com/almubarok/canopusgo.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

GitHub GitHub go.mod Go version GitHub code size in bytes GitHub all releases GitHub release (latest SemVer)

Overview

Canopusgo is implementation of canopus service using Golang.

Usage

Create service first:

key, err := ioutil.ReadFile("/your/path/to/M-00001.key")
if err != nil {
  fmt.Println(err)
}
pem, err := ioutil.ReadFile("/your/path/to/M-0001.pem")
if err != nil {
  fmt.Println(err)
}
client := &http.Client{Timeout: time.Second * time.Duration(60)}

cano := canopusgo.CreateService("snap", key, pem, "M-0001", "yoursecret", client)

Then you can user this service to create payment

func (cano *Canopus) GenerateSignature(payload []byte) (string, error)
func (cano *Canopus) GetToken() (string, error)
func (cano *Canopus) GetAvailableMethod(amount float64) ([]PaymentMethod, error)
func (cano *Canopus) GenerateCart(payload CartPayload, paymentMethod PaymentMethod) (CartResponse, error)

Check some examples canopusgo