Skip to content

almubarok/canopusgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages