Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

sendtips/qiwi

Repository files navigation

QIWI API Go client library

GitHub Actions GoDoc codecov Go Report Card Sourcegraph sendtips FOSSA Status

A Go client library to work with QIWI API.

Install

Install by import github.com/sendtips/qiwi or via go get github.com/sendtips/qiwi

The library support go1.14 and newer.

Library status

Library in early development, we not recommend use it on production till it reach v1.

Tests

Run tests using go test

Example

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
}

License

FOSSA Status