Go client package for the Gocoin API (https://gocoin.com)
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)
}Tests assume that there are 2 ENV variables set:
GOCOIN_MERCHANT_IDcontaining the MerchantIDGOCOIN_ACCESS_TOKENcontaining 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.