gerencianet / gn-api-sdk-go

SDK em Go integrada a API Gerencianet. Esta SDK está preparada para integração à API Boletos da Gerencianet, que lhe permite realizar o gerenciamento de cobranças com boleto/Bolix, carnê, cartão de crédito e muito mais.

Home Page:https://dev.gerencianet.com.br/docs/instalacao-sdk-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gn-api-sdk-go

A go library for integration of your backend with the payment services provided by Gerencianet.

Build Status Coverage Status

Installation

Install with:

$ go get github.com/gerencianet/gn-api-sdk-go/gerencianet
$ go mod init github.com/gerencianet/gn-api-sdk-go

Tested with

go 1.8, 1.11.4 and 1.16.5

Basic usage

import (
    "github.com/gerencianet/gn-api-sdk-go/gerencianet"
	"github.com/gerencianet/gn-api-sdk-go/examples/configs"
)

credentials := map[string]interface{} {
    "client_id": "client_id",
    "client_secret": "client_secret",
    "sandbox": false,
    "timeout": 10,
}

gn := gerencianet.NewGerencianet(credentials)

body = {
    "items": [{
        "name": "Product 1",
        "value": 1000,
        "amount": 2,
    }],
    "shippings": [{
        "name": "Default Shipping Cost",
        "value": 100,
    }]
}

res, err := gn.CreateCharge(body)

Examples

You can run the examples inside _examples with $ go run example.go:

$ go run charge/create_charge.go

Just remember to set the correct credentials inside examples/configs.go before running.

Tests

To run the tests, just run:

$ go test

Changelog

CHANGELOG

License

The library is available as open source under the terms of the MIT License.

About

SDK em Go integrada a API Gerencianet. Esta SDK está preparada para integração à API Boletos da Gerencianet, que lhe permite realizar o gerenciamento de cobranças com boleto/Bolix, carnê, cartão de crédito e muito mais.

https://dev.gerencianet.com.br/docs/instalacao-sdk-go

License:MIT License


Languages

Language:Go 100.0%