Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dundee/qrpay
Payment QR Code encoder for Go
https://github.com/dundee/qrpay
Last synced: about 2 months ago
JSON representation
Payment QR Code encoder for Go
- Host: GitHub
- URL: https://github.com/dundee/qrpay
- Owner: dundee
- License: mit
- Created: 2021-03-27T00:42:58.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-05T21:36:12.000Z (5 months ago)
- Last Synced: 2024-11-07T23:05:36.397Z (about 2 months ago)
- Language: Go
- Size: 30.3 KB
- Stars: 11
- Watchers: 3
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Payment QR code for Go
[![Build Status](https://travis-ci.com/dundee/qrpay.svg?branch=master)](https://travis-ci.com/dundee/qrpay)
[![codecov](https://codecov.io/gh/dundee/qrpay/branch/master/graph/badge.svg)](https://codecov.io/gh/dundee/qrpay)
[![Go Report Card](https://goreportcard.com/badge/github.com/dundee/qrpay)](https://goreportcard.com/report/github.com/dundee/qrpay)
[![Maintainability](https://api.codeclimate.com/v1/badges/6b488832f724e32e0c6e/maintainability)](https://codeclimate.com/github/dundee/qrpay/maintainability)
[![CodeScene Code Health](https://codescene.io/projects/14391/status-badges/code-health)](https://codescene.io/projects/14391)Golang library for creating QR codes for payments.
[Short Payment Descriptor](https://en.wikipedia.org/wiki/Short_Payment_Descriptor) format and
[EPC QR Code](https://en.wikipedia.org/wiki/EPC_QR_code) (SEPA) format is supported.## Installation
go get -u github.com/dundee/qrpay
## Usage
### Generating QR code image for Short Payment Descriptor format
```Go
import "github.com/dundee/qrpay"p := qrpay.NewSpaydPayment()
p.SetIBAN("CZ5855000000001265098001")
p.SetAmount("10.8")
p.SetDate(time.Date(2021, 12, 24, 0, 0, 0, 0, time.UTC))
p.SetMessage("M")
p.SetRecipientName("go")
p.SetNofificationType('E')
p.SetNotificationValue("[email protected]")
p.SetExtendedAttribute("vs", "1234567890")qrpay.SaveQRCodeImageToFile(p, "qr-payment.png")
```### Generating QR code image for EPC QR Code
```Go
import "github.com/dundee/qrpay"p := qrpay.NewEpcPayment()
p.SetIBAN("CZ5855000000001265098001")
p.SetAmount("10.8")
p.SetMessage("M")
p.SetRecipientName("go")qrpay.SaveQRCodeImageToFile(p, "qr-payment.png")
```QR code image encoding uses [skip2/go-qrcode](https://github.com/skip2/go-qrcode).
### Getting QR code content for Short Payment Descriptor format
```Go
import "github.com/dundee/qrpay"p := qrpay.NewSpaydPayment()
p.SetIBAN("CZ5855000000001265098001")
p.SetAmount("108")fmt.Println(qrpay.GenerateString())
// Output: SPD*1.0*ACC:CZ5855000000001265098001*AM:108*
```