qr_payment

package module
v0.0.0-...-625bfb5 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2018 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

QR Payment

Installation

$ go get -u github.com/opendream/qr-payment

Example for Thai QR Payment

Import package

import "github.com/opendream/qr-payment

Create QR Tag
qr := qr_payment.NewQrPaymentTag()
tag30 := qr.AddTag("30", "")
tag30.AddTag("00", "AID")
tag30.AddTag("01", "BillerID")
tag30.AddTag("02", "Ref1")
tag30.AddTag("03", "Ref2")
qr.AddTag("53", "764")
qr.AddTag("54", "1200.00")
qr.AddTag("58", "TH")
qr.AddTag("59", "Opendream")
// Addtional tag.
tag62 := qr.AddTag("62", "")
tag62.AddTag("07", "DOD00000001")

code := qr.GetQrCode()
Generate QR Image
import (
  "github.com/skip2/go-qrcode"
)

...

code := qr.GetQrCode()
png, err := qrcode.Encode(code, qrcode.Medium, 256)
if err != nil {
  // Do something
  return
}
Generate QR Image Data URI
dataUri := fmt.Sprintf(`data:image/png;base64,%s`, base64.StdEncoding.EncodeToString(png))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QrPaymentTag

type QrPaymentTag struct {
	Id    string
	Value string
	Code  string
	Tags  []*QrPaymentTag
}

func NewQrPaymentTag

func NewQrPaymentTag() *QrPaymentTag

func (*QrPaymentTag) AddTag

func (q *QrPaymentTag) AddTag(id string, value string) *QrPaymentTag

func (*QrPaymentTag) GetCode

func (q *QrPaymentTag) GetCode() string

func (*QrPaymentTag) GetQrCode

func (q *QrPaymentTag) GetQrCode() string

func (*QrPaymentTag) GetTag

func (q *QrPaymentTag) GetTag(id string) *QrPaymentTag

Jump to

Keyboard shortcuts

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