Skip to content

leonelquinteros/gocoin-go

Repository files navigation

GitHub release MIT license GoDoc Go Report Card

Gocoin Go SDK

Go client package for the Gocoin API (https://gocoin.com)

Quick start

package main

import (
    "fmt"
    "os"

    "github.com/leonelquinteros/gocoin"
)

func main() {
    // Create client
    cli := gocoin.New(os.Getenv("GOCOIN_MERCHANT_ID"), os.Getenv("GOCOIN_ACCESS_TOKEN"))

    // Create invoice data
    data := gocoin.CreateInvoice{
        PriceCurrency:     "LTC",
        BasePrice:         "10.32",
        BasePriceCurrency: "USD",
        CallbackURL:       "https://testgocoin.com/callback",
    }

    invoice, err := cli.Invoices().Create(data)
    if err != nil {
        panic(err)
    }
    
    fmt.Printf("Invoice generated: \n%v", invoice)
}

Testing

Tests assume that there are 2 ENV variables set:

  • GOCOIN_MERCHANT_ID containing the MerchantID
  • GOCOIN_ACCESS_TOKEN containing the Access Token for auth requests.

Some tests may not use both or either at all, but most of them will need to have these set in order to work properly.

About

Gocoin SDK for Go programming language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages