Files

1.0 KiB

qbirr-go

Go client for the qbirr Ethiopian bank verification API.

Install

go get github.com/qbirr/sdk-go

Quick start

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/qbirr/sdk-go"
)

func main() {
	qb := qbirr.New(os.Getenv("QBIRR_API_KEY"))

	r, err := qb.Verify(context.Background(), qbirr.VerifyRequest{
		Provider:        qbirr.ProviderCBE,
		Ref:             "FT23001234ABC",
		Amount:          500,
		ReceiverName:    "YOUR NAME",
		ReceiverAccount: "1000017692643",
	})
	if err != nil {
		fmt.Println("API error:", err)
		return
	}
	if r.Verified {
		fmt.Printf("✓ Paid by %s, amount: %.2f\n", r.Payer, r.Amount)
	} else {
		fmt.Println("✗", r.Error)
	}
}

Errors

Network and HTTP errors return as Go error. Verification failures (wrong amount, wrong receiver, etc.) are NOT errors — they're returned as VerifyResult{Verified: false, Error: "..."}.

var apiErr *qbirr.APIError
if errors.As(err, &apiErr) {
    fmt.Println("HTTP status:", apiErr.Status)
}

License

MIT