Giter Site home page Giter Site logo

paystack's Introduction

Paystack

Go Reference Go Report Card

A 3rd party client package for Paystack in GO.

Usage

Using paystack in your go project is quite simple. All you need to do is import it into your project and create an APIClient as shown below. The APIClient is all you need for interacting with Paystack in your Go project. it has fields on with which are dedicated clients tailored to interfacing with endpoints groups provided by Paystack. As seen in the example below, the APIClient.Transactions field provides associated functions to interfacing with Paystack's Transaction resource. e.g., All in the example below retrieves all the transactions in you integration. See the comprehensive list below or package reference for fields on the APIClient. It is worth mentioning that all the associated functions of the fields on the APIClient return a Response and an error. The Response struct contains a StatusCode and a Data field. The StatusCode is the http status code returned from making an http request to Paystack and the Data is a json serializable slice of byte containing the response data returned from Paystack from making the request. The paystack package does not provide structs for deserializing the Data, hence you're free to deserialize the Data as you wish. The simplest way to deserialize the data is shown below.

package main

import (
	p "github.com/gray-adeyi/paystack"
	"encoding/json"
	"fmt"
)

func main(){
	client := p.NewAPIClient(p.WithSecretKey("<your-secret-key>"))
	resp, err := client.Transactions.All()
	if err != nil {
		panic(err)
    }
	
	var data map[string]interface{}
	
	if err = json.Unmarshal(resp.Data, &data); err != nil {
		panic(err)
    }
	fmt.Println(data)
}

APIClient fields

Fields
APIClient.Tansactions
APIClient.TansactionSplits
APIClient.Terminals
APIClient.Customers
APIClient.DedicatedVirtualAccounts
APIClient.ApplePay
APIClient.SubAccounts
APIClient.Plans
APIClient.Subscriptions
APIClient.Products
APIClient.PaymentPages
APIClient.PaymentRequests
APIClient.Settlements
APIClient.TransferControl
APIClient.TransferRecipients
APIClient.Transfers
APIClient.BulkCharges
APIClient.Integration
APIClient.Charges
APIClient.Disputes
APIClient.Refunds
APIClient.Verification
APIClient.Miscellaneus

Package Limitations

While the paystack package has an 100% coverage of the endpoints currently provided by Paystack, it does not have a sufficient test coverage.

paystack's People

Contributors

gray-adeyi avatar

Stargazers

 avatar  avatar

Watchers

 avatar

paystack's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.