Pix-Utils is a set of tools to parse, generate and validate payments of Brazil Instant Payment System (Pix), making fast and simple to handle charges and proccess then in your project. Originally developed using TypeScript, this is the Go version of the library.
- Parse Static Pix EMV
- Parse Dynamic Pix EMV
- Validate CRC16
- Generate Static Pix EMV
- Generate Dynamic Pix EMV
- Generate QRCode Image from EMV or Pix
This library also normalize the input data to the Pix standard, so you don't need to worry about it. It follows the Pix Specification, that mainly contains the following guidelines about EMV data structure:
- Merchant Name: 25 characters
- Merchant City: 15 characters
- Pix Key/Payload URL: 77 characters
go get github.com/thalesog/go-pix-utils
package main
import (
"fmt"
"github.com/thalesog/go-pix-utils/pixUtils"
)
func main() {
pix := pixUtils.CreateStaticPix(pixUtils.CreateStaticPixParams{
MerchantName: "Thales Ogliari",
MerchantCity: "São Miguel do Oeste",
PixKey: "thalesog@me.com",
TransactionAmount: 10.00,
AditionalData: "Pedido 123",
})
fmt.Printf("Pix Type: %s \n", pix.Type)
fmt.Printf("EMV Code: %s \n", pix.Raw)
fmt.Printf("Pix Elements: %v \n", pix.Elements)
}
package main
import (
"fmt"
"github.com/thalesog/go-pix-utils/pixUtils"
)
func main() {
pix := pixUtils.CreateDynamicPix(pixUtils.CreateDynamicPixParams{
MerchantName: "Thales Ogliari",
MerchantCity: "São Miguel do Oeste",
Url: "https://pix.thalesogliari.com.br",
})
fmt.Printf("Pix Type: %s \n", pix.Type)
fmt.Printf("EMV Code: %s \n", pix.Raw)
fmt.Printf("Pix Elements: %v \n", pix.Elements)
}
Please contribute using GitHub Flow. Create a branch, add commits, and open a pull request.
This project is under MIT license.
Developed with 💚 by @thalesog 🇧🇷