Initial release: qbirr Go SDK v1.0.0
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# qbirr-go
|
||||
|
||||
Go client for the qbirr Ethiopian bank verification API.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
go get github.com/qbirr/sdk-go
|
||||
```
|
||||
|
||||
## Quick start
|
||||
|
||||
```go
|
||||
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: "..."}`.
|
||||
|
||||
```go
|
||||
var apiErr *qbirr.APIError
|
||||
if errors.As(err, &apiErr) {
|
||||
fmt.Println("HTTP status:", apiErr.Status)
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Reference in New Issue
Block a user