# Payloads (laravel-go-qrcode)

> A QR code holds text. Phones act on some formats: they open an email draft, dial a number or join a WiFi network. Each payload type builds that text; pass the…

- Package: laravel-go-qrcode (Laravel for Go, alpha), go modules: `github.com/bowerbird-si/laravel-go-qrcode`
- Maintenance: active; Latest release: 0.1.0 (2026-12-04); Framework: go.laravel.com v0.2.0 or later; Go: Go 1.27 or later; Licence: MIT
- Links: [Repository](https://github.com/bowerbird-si/laravel-go-qrcode), [pkg.go.dev](https://pkg.go.dev/github.com/bowerbird-si/laravel-go-qrcode@v0.1.0), [Changelog](https://oss.bowerbird.si/go-qrcode/docs/changelog/), [Contributing](https://github.com/bowerbird-si/laravel-go-qrcode/blob/ba3241b489aeb301f0dcce65f5cea9e55f79dc24/CONTRIBUTING.md), [Security policy](https://github.com/bowerbird-si/laravel-go-qrcode/blob/ba3241b489aeb301f0dcce65f5cea9e55f79dc24/SECURITY.md)
- Based on: [Simple QrCode](https://github.com/SimpleSoftwareIO/simple-qrcode): The QR code builder this package ports: formats, styling, logos, payload helpers and Laravel integration, following version 4.2.0.; [go-qr](https://github.com/krobertson/go-qr): QR encoding.; [gozxing](https://github.com/makiuchi-d/gozxing): Scans the generated codes in the tests.
- PHP parity: full (23 covered, 27 diverged, 0 planned of 50 abilities; 74 fixtures; follows simplesoftwareio/simple-qrcode 4.2.0; verified 2026-12-04)
- Community package, not affiliated with Laravel.
- HTML version: https://oss.bowerbird.si/go-qrcode/docs/payloads/
- Source: https://github.com/bowerbird-si/laravel-go-qrcode/blob/ba3241b489aeb301f0dcce65f5cea9e55f79dc24/docs/payloads.md

A QR code holds text. Phones act on some formats: they open an email draft, dial a number or join a WiFi
network. Each payload type builds that text; pass the result to any render method.

```go
text, err := qrcode.PhoneNumber{Number: "+32 9 123 45 67"}.Payload()
if err != nil {
	return err
}
png, err := g.PNG(text)
```

Optional fields are pointers: leave them `nil` to omit them.

| Type | Fields | Example output |
| --- | --- | --- |
| `qrcode.Email` | `To`, `Subject *string`, `Body *string` | A draft with a prefilled subject |
| `qrcode.PhoneNumber` | `Number` | `tel:+32-9-123-45-67` |
| `qrcode.SMS` | `Number`, `Body *string` | `sms:+3291234567?body=See%20you%20at%208` |
| `qrcode.Geo` | `Latitude`, `Longitude` | `geo:51.05,3.72` |
| `qrcode.WiFi` | `SSID`, `Auth`, `Password *string`, `Hidden *bool` | `WIFI:T:WPA;S:Guest;P:guest-code;` |
| `qrcode.Bitcoin` | `Address`, `Amount *string`, `Label *string`, `Message *string`, `ReturnURL *string` | `bitcoin:bc1qexample?amount=0.001` |

Invalid fields return `qrcode.ErrInvalidPayload`: a phone number with characters that don't belong in
one, coordinates outside ±90 and ±180, or a Bitcoin amount that isn't a plain decimal.

## WiFi

```go
password := "guest-code"
hidden := true
text, err := qrcode.WiFi{
	SSID:     "Guest",
	Auth:     qrcode.WiFiWPA,
	Password: &password,
	Hidden:   &hidden,
}.Payload()
```

`Auth` is `qrcode.WiFiWPA` (WPA and WPA2), `qrcode.WiFiSAE` (WPA3), `qrcode.WiFiWEP`,
`qrcode.WiFiNoPassword` (an open network, stated) or `qrcode.WiFiOpen` (the field left out). The
package escapes `;`, `,`, `:`, `\` and `"` in the SSID and password.

## Differences from PHP

- Email uses `%20` for spaces and CRLF in the message body.
- Phone numbers use hyphens as visual separators where the input contains spaces.
- SMS requires a recipient and percent-escapes the `?body=` query. [RFC 5724](https://www.rfc-editor.org/rfc/rfc5724)
- Geo formats coordinates as decimal degrees, including very small values.
- WiFi escapes delimiters and writes an explicit boolean as `true` or `false`. [Simple QrCode #333](https://github.com/SimpleSoftwareIO/simple-qrcode/issues/333)
- Bitcoin takes an exact decimal string. It percent-escapes query values and omits the question mark when all parameters are unset.
