Popularity
0.3
Stable
Activity
0.0
Declining
3
1
0
Programming language: Go
License: MIT License
Tags:
Third-party APIs
dusupay-sdk-go alternatives and similar packages
Based on the "Third-party APIs" category.
Alternatively, view dusupay-sdk-go alternatives based on common mentions on social networks and blogs.
-
githubql
Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://docs.github.com/en/graphql). -
openaigo
OpenAI GPT3/3.5 and GPT4 ChatGPT API Client Library for Go, simple, less dependencies, and well-tested -
gostorm
GoStorm is a Go library that implements the communications protocol required to write Storm spouts and Bolts in Go that communicate with the Storm shells.
InfluxDB - Purpose built for real-time analytics at any scale.
InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.
Promo
www.influxdata.com
Do you think we are missing an alternative of dusupay-sdk-go or a related project?
README
Dusupay API SDK GO (Unofficial)
Description
Unofficial Dusupay payment gateway API Client for Go
API documentation
Installation
go get -u github.com/kachit/dusupay-sdk-go
Usage
package main
import (
"fmt"
"context"
dusupay "github.com/kachit/dusupay-sdk-go"
)
func main(){
// Create a client instance
cfg := dusupay.NewConfig("Your public key", "Your secret key")
client, err := dusupay.NewClientFromConfig(cfg, nil)
if err != nil {
fmt.Printf("config parameter error " + err.Error())
panic(err)
}
}
Get balances list
ctx := context.Background()
balances, response, err := client.Merchants().GetBalances(ctx)
if err != nil {
fmt.Printf("Wrong API request " + err.Error())
panic(err)
}
//Dump raw response
fmt.Println(response)
//Dump result
fmt.Println(balances.Status)
fmt.Println(balances.Code)
fmt.Println(balances.Message)
fmt.Println((*balances.Data)[0].Currency)
fmt.Println((*balances.Data)[0].Balance)
Get banks list
ctx := context.Background()
filter := &dusupay.BanksFilter{TransactionType: dusupay.TransactionTypePayout, Country: dusupay.CountryCodeGhana}
banks, response, err := client.Banks().GetList(ctx, filter)
if err != nil {
fmt.Printf("Wrong API request " + err.Error())
panic(err)
}
//Dump raw response
fmt.Println(response)
//Dump result
fmt.Println(banks.Status)
fmt.Println(banks.Code)
fmt.Println(banks.Message)
fmt.Println((*banks.Data)[0].Id)
fmt.Println((*banks.Data)[0].Name)
fmt.Println((*banks.Data)[0].BankCode)
Get banks branches list
ctx := context.Background()
filter := &dusupay.BanksBranchesFilter{Country: dusupay.CountryCodeGhana, Bank: "BankCode"}
branches, response, err := client.Banks().GetBranchesList(ctx, filter)
if err != nil {
fmt.Printf("Wrong API request " + err.Error())
panic(err)
}
//Dump raw response
fmt.Println(response)
//Dump result
fmt.Println(branches.Status)
fmt.Println(branches.Code)
fmt.Println(branches.Message)
fmt.Println((*branches.Data)[0].Name)
fmt.Println((*branches.Data)[0].Code)
Get providers list
ctx := context.Background()
filter := &dusupay.ProvidersFilter{Country: dusupay.CountryCodeUganda, Method: dusupay.TransactionMethodMobileMoney, TransactionType: dusupay.TransactionTypeCollection}
providers, response, err := client.Providers().GetList(ctx, filter)
if err != nil {
fmt.Printf("Wrong API request " + err.Error())
panic(err)
}
//Dump raw response
fmt.Println(response)
//Dump result
fmt.Println(providers.Status)
fmt.Println(providers.Code)
fmt.Println(providers.Message)
fmt.Println((*providers.Data)[0].ID)
fmt.Println((*providers.Data)[0].Name)
Create collection request
ctx := context.Background()
request := &dusupay.CollectionRequest{
Currency: dusupay.CurrencyCodeUGX,
Amount: 10000,
Method: dusupay.TransactionMethodMobileMoney,
ProviderId: "airtel_ug",
MerchantReference: "1234567891",
RedirectUrl: "http://foo.bar",
Narration: "narration",
AccountNumber: "256752000123",
MobileMoneyHpp: true,
}
result, response, err := client.Collections().Create(ctx, request)
if err != nil {
fmt.Printf("Wrong API request " + err.Error())
panic(err)
}
//Dump raw response
fmt.Println(response)
//Dump result
fmt.Println(result.Status)
fmt.Println(result.Code)
fmt.Println(result.Message)
fmt.Println((*result.Data).ID)
fmt.Println((*result.Data).PaymentURL)
Create payout request
ctx := context.Background()
request := &dusupay.PayoutRequest{
Currency: dusupay.CurrencyCodeUGX,
Amount: 10000,
Method: dusupay.TransactionMethodMobileMoney,
ProviderId: "airtel_ug",
MerchantReference: "1234567892",
Narration: "narration",
AccountNumber: "256752000123",
AccountName: "Foo Bar",
}
result, response, err := client.Payouts().Create(ctx, request)
if err != nil {
fmt.Printf("Wrong API request " + err.Error())
panic(err)
}
//Dump raw response
fmt.Println(response)
//Dump result
fmt.Println(result.Status)
fmt.Println(result.Code)
fmt.Println(result.Message)
fmt.Println((*result.Data).ID)
Create refund request
ctx := context.Background()
request := &dusupay.RefundRequest{
Amount: 100,
InternalReference: "DUSUPAY5FNZCVUKZ8C0KZE",
}
result, response, err := client.Refunds().Create(ctx, request)
if err != nil {
fmt.Printf("Wrong API request " + err.Error())
panic(err)
}
//Dump raw response
fmt.Println(response)
//Dump result
fmt.Println(result.Status)
fmt.Println(result.Code)
fmt.Println(result.Message)
fmt.Println((*result.Data).ID)
*Note that all licence references and agreements mentioned in the dusupay-sdk-go README section above
are relevant to that project's source code only.