Unofficial SDK for Chapa Payment Gateway in Ethiopia
# Unofficial Chapa SDK for Golang
Unofficial Golang SDK for Chapa Payment Gateway in Ethiopia.
## Overview
This SDK provides a convenient way to interact with Chapa's API for payments in Ethiopia.
## Installation
```bash
go get
github.com
```
## Example Code
``` go
package main
import (
"context"
"fmt"
"log"
"
github.com"
"
github.com"
"
github.com"
)
func main() {
// Initialize the Chapa client with your API keys
chapa := chapasdk.NewClient("CHAPUBK_PUBLIC_KEY", "CHASECK_SECRET_KEY", "ENCRYPTION_KEY", false)
// Initialize a transaction
resp, err := chapa.InitTransaction(context.Background(), model.InitTransactionReq{
Amount: decimal.NewFromInt(30),
Currency: "ETB",
Email: "test@gmail.com",
FirstName: "Alazar",
LastName: "Beyene",
PhoneNumber: "0975146165",
TxRef: "chewatatest-6669",
CallbackURL: "
localhost",
ReturnURL: "
localhost",
CustomizationTitle: "Test Payment",
CustomizationDescription: "Test transaction",
Meta: true,
})
if err != nil {
log.Fatal("Error initializing transaction:", err)
}
fmt.Println("Transaction Response:", resp)
}
```