Skip to content

stone-payments/merchant-go-stone-openbank

 
 

Repository files navigation

merchant-go-stone-openbank

A forked Go library of go-stone-openbank to connect Stone Open Banking API

How to install

go get github.com/stone-payments/merchant-go-stone-openbank

Example Usage

package main

import (
	openbank "github.com/stone-payments/merchant-go-stone-openbank"
	"github.com/stone-payments/merchant-go-stone-openbank/types"
)

func main() {
	clientID := os.Getenv("STONE_CLIENT_ID")
	privKeyPath := os.Getenv("STONE_PRIVATE_KEY")
	consentURL := os.Getenv("STONE_CONSENT_REDIRECT_URL")

	pemPrivKey := readFileContent(privKeyPath)

	client, err := openbank.NewClient(
		openbank.WithClientID(clientID),
		openbank.SetConsentURL(consentURL),
		openbank.WithPEMPrivateKey(pemPrivKey),
		openbank.UseSandbox(),
	//	openbank.EnableDebug(),
	)
	if err != nil {
		log.Fatal(err)
	}

	err := client.Authenticate(context.Background())
	if err != nil {
		log.Fatal(err)
	}
}

func readFileContent(path string) []byte {
	content, _ := ioutil.ReadFile(path)
	return content
}

see full example

About

A Go library to connect with Stone Open Banking API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%