A Go client library to work with QIWI API.
Install by import github.com/sendtips/qiwi
or via go get github.com/sendtips/qiwi
The library support go1.14
and newer.
Library in early development, we not recommend use it on production till it reach v1
.
Run tests using go test
To obtain a payment session on QIWI website you need to create a new qiwi object via qiwi.New()
and call its CardRequest()
method.
package main
import (
"log"
"context"
"github.com/sendtips/qiwi"
)
func main() {
pay := qiwi.New("OrderID", "SiteID", "TOKEN", "http://example.com/qiwi-api")
err := pay.CardRequest(context.TODO(), 300) // Request session for 3.00RUB
if err != nil {
log.Fatalf("Error occurred: %s", err)
}
log.Printf("Pay via link: %s", pay.PayURL) // Payment session URL on QIWI website
}