Skip to content

kenriortega/qvapay-go

Repository files navigation

qvapay-go

A simple non-official paymentClient for qvapay service with go, for our comunity

License: MIT

Setup

You can install this package by using the go get tool and installing:

go get github.com/kenriortega/qvapay-go

Sign up on QvaPay

Create your account to process payments through QvaPay at qvapay.com/register.

Using the paymentClient

First create your QvaPay paymentClient using your app credentials.

paymentClient := qvapaygo.NewClient(
    os.Getenv("APP_ID"), // app_id
    os.Getenv("SECRET_ID"), // secret_id
    qvapaygo.BaseURL, // constants url base https://qvapay.com/api
    false, // skip verificationSSL
    nil, // custom http.PaymentAppClient
    nil, // debug io.Writter (os.Stdout)
)

Get your app info

...
info, err := paymentClient.GetInfo(context.Background())
if err != nil {
    log.Fatalf(err.Error())
}
fmt.Println(info)

Get your account balance

...
balance, err := paymentClient.GetBalance(context.Background())
if err != nil {
    log.Fatalf(err.Error())
}
fmt.Println(balance)

Create an invoice

...
invoice, err := paymentClient.CreateInvoice(
    context.Background(),
    25.60,
    "Enanitos verdes",
    "BRID56568989",
)
if err != nil {
    log.Fatalf(err.Error())
}
fmt.Println(invoice)

Get transaction

...
inputId := "6507ee0d-db6c-4aa9-b59a-75dc7f6eab52"
tx, err := paymentClient.GetTransaction(context.Background(), inputId)
if err != nil {
    log.Fatalf(err.Error())
}
fmt.Println(tx)

Get transactions

...
txs, err := paymentClient.GetTransactions(context.Background())
if err != nil {
    log.Fatalf(err.Error())
}
fmt.Println(txs)

You can also read the QvaPay API documentation: qvapay.com/docs. ​

About

A simple non-official client for qvapay service with go, for our comunity

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages