Skip to content

SDK em Go integrada a API Gerencianet. Esta SDK está preparada para integração à API Pix, que lhe permite realizar o gerenciamento de cobranças Pix com QR Code e Pix Copia e Cola e muito mais.

License

gerencianet/gn-api-sdk-go-pix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alt text

gn-api-sdk-go-pix

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-pix/gerencianet
$ go mod init github.com/gerencianet/gn-api-sdk-go-pix

Tested with

go 1.16.5

Certificate conversion

openssl pkcs12 -in path.p12 -out newfile.crt.pem -clcerts -nokeys  //  certificado 
openssl pkcs12 -in path.p12 -out newfile.key.pem -nocerts -nodes //  chave privada

Basic usage

import (
	"fmt"
	"github.com/gerencianet/gn-api-sdk-go-pix/gerencianet"
	"github.com/gerencianet/gn-api-sdk-go-pix/_examples/configs"
)

credentials := map[string]interface{} {
    "client_id": "Your Client_Id",
	"client_secret": "Your Client_Secret",
	"sandbox": true,
	"timeout": 20,
	"CA" : "Path to your public key",
	"Key" : "Path to your private key",
}

gn := gerencianet.NewGerencianet(credentials)

body := map[string]interface{} {
		
		"calendario": map[string]interface{} {
				"expiracao": 3600,
			},
		"devedor": map[string]interface{}{
			
				"cpf": "12345678909",
				"nome": "Francisco da Silva",
			
		},
		"valor": map[string]interface{} {
			
				"original": "00.01",
			
		},
		"chave": "47e7e515-44d3-42cc-8e1f-ef529b4ba4d1",
		"solicitacaoPagador": "Teste.",
		"infoAdicionais": []map[string]interface{} {
			{
				"nome": "Campo 1",
				"valor": "Informação Adicional1 do PSP-Recebedor",
			},
		},
	}

res, err := gn.CreateImmediateCharge(body)

Examples

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

$ go run chargecreateImmediateCharge.go

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

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 Pix, que lhe permite realizar o gerenciamento de cobranças Pix com QR Code e Pix Copia e Cola e muito mais.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages