Canopusgo is implementation of canopus service using Golang.
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