pix

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package pix generates Brazilian Pix Copy and Paste or QR Codes

As a simple example:

options := pix.Options{
	Name: "Jonnas Fonini",
	Key: "jonnasfonini@gmail.com",
	City: "Marau",
	Amount: 20.67, // optional
	Description: "Invoice #4", // optional
	TransactionID: "***", // optional
}

copyPaste, err := pix.Pix(options)

if err != nil {
	panic(err)
}

fmt.Println(copyPaste) // will output: "00020126580014BR.GOV.BCB.PIX0122jonnasfonini@gmail.com0210Invoice #4520400005303986540520.675802BR5913Jonnas Fonini6005Marau62410503***50300017BR.GOV.BCB.BRCODE01051.0.06304CF13"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pix

func Pix(options Options) (string, error)

Pix generates a Copy and Paste Pix code

func QRCode

func QRCode(options QRCodeOptions) ([]byte, error)

QRCode returns a graphical representation of the Copy and Paste code in a QR Code form.

Types

type Options added in v1.0.1

type Options struct {
	// Pix Key (CPF/CNPJ, Email, Cellphone or Random Key)
	Key string
	// Receiver name
	Name string
	// Receiver city
	City string
	// Transaction amount
	Amount float64
	// Transaction description
	Description string
	// Transaction ID
	TransactionID string
}

Options is a configuration struct.

func ReadPix added in v1.1.0

func ReadPix(copyPaste string) (Options, error)

ReadPix generates a Options struct using a copyPaste PIX code

type QRCodeOptions

type QRCodeOptions struct {
	// QR Code content
	Content string
	// Default: 256
	Size int
}

QRCodeOptions is a configuration struct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL