Advanced usage Payload generators

Raffael Herrmann edited this page May 22, 2024 · 32 revisions
  1. Introduction to the "Payload Generator"
  2. Overview of the different payload types
  3. Usage of the payload generators
    3.1 BezahlCode
    3.2 Crypto Payment Address (e.g. Bitcoin, Litecoin, ...)
    3.3 Bookmark
    3.4 Calendar events (iCal/vEvent)
    3.5 ContactData (MeCard/vCard)
    3.6 Geolocation
    3.7 Girocode
    3.8 Mail
    3.9 MMS
    3.10 Monero address/payment
    3.11 One-Time-Password
    3.12 Phonenumber
    3.13 Russia Payment Order
    3.14 Shadowsocks configuration
    3.15 Skype call
    3.16 Slovenian QR Code for UPN QR Forms
    3.17 SMS
    3.18 SwissQrCode (ISO-20022)
    3.19 URL
    3.20 WhatsAppMessage
    3.21 WiFi
  4. Development of own payload types

1. Introduction to the "Payload Generator"

The payload generator is one of the things, which make the QRCoder unique. It's a class which helps to generate special payloads (=the text encoded in QR codes) that will start different actions on the device which scans the QR code.

Indeed a QR code can only encode a string (of text), but if this string has a special format, most* QR code scanners will perform a predefined action.

To help you to create these special formatted payload strings, we implemented the payload generators. These are easy-to-use classes, which check your data for invalid inputs and "automagically" create the fitting payload strings for you.

Info:Keep in mind, that all payload types stand and fall with the commitment between QR encoders and QR scanner apps. Special payload types aren't defined in the QR code standard (ISO/IEC 18004). Most of the QR code scanner apps are able to interpret the payload types described on this page. But in a real world application you should test your QR codes against the scanners your users will use.


2. Overview of the different payload types

Right now there are 19 different payload generators. To get a quick overview, have a look at the following table.

(Class-)NameWhat does it do, when scanned?Specification
BezahlCodeOpens the banking app for bank transfers, debits and banker's order. It's common in German-speaking countries and competes with the more common GiroCode.Bezahlcode specification
Bitcoin(LikeCryptoCurrency)AddressStarts crypto currency app for transfers.BIP 0021
BookmarkSaves a bookmark to the default webbrowser.NTTdocomo MEBKM
CalendarEventAdds an event to the user's calendar. Supports iCal and vEvent format.RFC 5545
ContactDataAdds a contact to the user's address book. Supports MeCard, vCard 2.1, vCard 3.0 and vCard 4.0 format.NTTdocomo MeCard, RFC 2425 (vCard 2.1), RFC 2426 (vCard 3.0), RFC 6350 (vCard 4.0)
GeolocationOpens the maps app and shows the given location or opens Google Maps in browser.RFC 5870
GirocodeOpens the banking app for bank transfers. It's common in the European region and competes with the less common BezahlCode.EPC069-12
MailOpens the default email app and composes a new message. Supports mailto:, MATMSG: and smtp: format.RFCRFC 6068, NTTdocomo MATMSG, smtp URI scheme
MMSOpens the standard messaging app and composes a new MMS. Either in mmsto: or in mms: format.RFC draft (mmsto), Data Services: Whitepaper (mms)
MoneroTransactionOpens the Monero wallet with transaction details.Monero URI scheme
OneTimePasswordEncoded secret keys. May be used in combination with Google Authenticator for example.Key URI Format
PhoneNumberOpens the phone's dialer app with given number.RFC 3966
ShadowSocksConfigOpens ShadowSocks app with given configuration.ShadowSocks URI scheme
SkypeCallOpens Skype app and calls given contact.Skype URI API reference
SlovenianUpnQrUsed for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order).Technical description, Advice for programmers
SMSOpen SMS app and composes new message. Supports sms:, sms: (for iOS) and SMSTO: format.RFC 5724 (sms), sms URI for iOS, SMSTO (not common)
SwissQrCodeOpens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein).ISO 20022
UrlOpens the given URL in default webbrowser.RFC 3986
WhatsAppMessageOpen whatsapp, lets you choose a contact and composes a new message with given text.WhatsApp URL Scheme
WiFiWhen scanned, the scanning device can login to the given WiFi without typing the credentials.Short description

3. Usage of the payload generators

3.1 BezahlCode

Classname/Classfile: BezahlCode / PayloadGenerator.cs

When to use?

Use it for banking (inlcuding bank transfers, debits, bank contacts and banker's order). It's used in German-speaking countries and competes with the more common GiroCode.

How to use it - simple way

The following code generates a payload for a simple SEPA payment to Wikimedia.

BezahlCodegenerator=newBezahlCode(BezahlCode.AuthorityType.singlepaymentsepa,"Wikimedia",iban:"DE33100205000001194700",bic:"BFSWDE33BER",amount:25.00m);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are four overloads:

Overload 1
Description: Creates a payload for SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 2
Description: Creates a payload for non SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 3
Description: Creates a payload for exchange of bank/payment contact data

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstring""Bank account (Kontonummer)
bncstring""Bank institute (Bankleitzahl)
ibanstring""IBAN
bicstring""BIC
reasonstring""Reason (Verwendungszweck)

Overload 4
Description: Generic constructor used by overload 1 and 2.

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)
internalModeint0Only used for internal state handdling

Good to know

BezahlCode is a format which competes with the GiroCode. Both can be used for banking purposes but GiroCode is a little more common and newer. Nevertheless BezahlCode has some more features like periodic transfer and debits. So before choose one of both, check which one fits your needs and which one is better supported by your users and their QR code scanner apps.


3.2 (Bitcoin like) Crypto Currency Payment Address

Classname/Classfile: BitcoinAddress|BitcoinCashAddress|LitecoinAddress / PayloadGenerator.cs

When to use?

Use this payload to share Bitcoin/Bitcoin Cash/Litecoin addresses or initiate payments in one of those currencies.

How to use it - simple way

BitcoinAddressgenerator=newPayloadGenerator.BitcoinAddress("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W",1.5d);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a Bitcoin address with or without amount to transfer and message.

Parameter nameTypeDefaultDescription
addressstringBitcoin address of the payment receiver
amountdouble?Amount of Bitcoins to transfer
labelstringnullReference label
messagestringnullReferece text aka message

Good to know

If you want to share only the crypto currency address without any amount of coins, set the variable amount to null. Replace "Bitcoin" by "BitcoinCash" or "Litecoin" to generate payloads for those currencies.


3.3 Bookmark

Classname/Classfile: Bookmark / PayloadGenerator.cs

When to use?

Use this payload, when you want to place a bookmark in the user's default webbrowser.

How to use it - simple way

Bookmarkgenerator=newBookmark("http://code-bude.net","Blog of QRCoder's father");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a bookmark payload including the bookmark title.

Parameter nameTypeDefaultDescription
urlstringUrl of the bookmark
titlestringTitle of the bookmark

Good to know

n/a


3.4 Calendar events (iCal/vEvent)

Classname/Classfile: CalendarEvent / PayloadGenerator.cs

When to use?

Use this payload to place an event to the user's calendar application.

How to use it - simple way

CalendarEventgenerator=newCalendarEvent("Birthday party","Join QRCoder's fourth birthday!","51.26118,6.6717",newDateTime(2017,10,13),newDateTime(2017,10,13),true);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeStart time of the event
endDateTimeEnd time of the event
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Overload 2
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeOffsetStart time of the event incl. offset in relation to UTC
endDateTimeOffsetEnd time of the event incl. offset in relation to UTC
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Good to know

The parameters description and location are optional. They can be set to null or string.Empty. If you want to place an event to Apple users you should use iCal instead of Universal as encoding.


3.5 ContactData (MeCard/vCard)

Classname/Classfile: ContactData / PayloadGenerator.cs

When to use?

Use it, when you want to share contact data/business cards. A QR code with this payload type will add the contact data to the user's address book.

How to use it - simple way

ContactDatagenerator=newContactData(ContactData.ContactOutputType.VCard3,"John","Doe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates contact data payload in different formats.

Parameter nameTypeDefaultDescription
outputTypeContactOutputTypePayload output type
firstnamestringThe firstname
lastnamestringThe lastname
nicknamestringnullThe displayname
phonestringnullNormal phone number
mobilePhonestringnullMobile phone
workPhonestringnullOffice phone number
emailstringnullE-Mail address
birthdayDateTime?nullBirthday
websitestringnullWebsite / Homepage
streetstringnullStreet
houseNumberstringnullHousenumber
citystringnullCity
zipCodestringnullZip code
countrystringnullCountry
notestringnullMemo text / notes
stateRegionstringnullState / Region
addressOrderAddressOrderAddressOrder.Defaultenum to define address order (see below)
orgstringnullOrganization/Company
orgTitlestringnullOrganization/Company title

Good to know

Via the parameter outputType you can choose between different formats. Supported formats are: vCard 2.1, vCard 3.0, vCard 4.0 and MeCard. Choose the format which fits your needs. Right now vCard 3.0 is the most used format.

The addressOrderenum specifies in which format the address is rendered. The two options are:

  • Default
    The address format used in European countries and others.
    Sample

    John Doe
    Königsallee 1
    40210 Düsseldorf
    Germany

  • Reversed
    The address format used in North America and others.
    Sample

    John Doe
    123 Fake St.
    Cleveland, OH, 12345
    USA


3.6 Geolocation

Classname/Classfile: Geolocation / PayloadGenerator.cs

When to use?

Use this payload type when you want to share a location. You can choose between the geo-format and Google Maps links.

How to use it - simple way

Geolocationgenerator=newGeolocation("51.26118","6.6717");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: The payload encodes a (geo-)location by its coordinates.

Parameter nameTypeDefaultDescription
latitudestringLatitude with . as splitter
longitudestringLongitude with . as splitter
encodingGeolocationEncodingGeolocationEncoding.GEOEncoding type - GEO or GoogleMaps

Good to know

If you use the geo-format the QR scanner app must support this tag. Most scanners do so. But if you want to be 100% on the safe side, choose Google Maps format because this generates a Google Maps (web-)link which can be interpreted by nearly any QR code scanner.


3.7 Girocode

Classname/Classfile: Girocode / PayloadGenerator.cs

When to use?

Use this payload type if you want to share payment contact information and/or bank transfer data. The Girocode is an European standard and supports SEPA payments.

How to use it - simple way

varpayload=newGirocode("DE33100205000001194700","BFSWDE33BER","Wikimedia",1337.99m);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates the Girocode payload with different options.

Parameter nameTypeDefaultDescription
ibanstringAccount number of the Beneficiary. Only IBAN is allowed.
bicstringBIC of the Beneficiary Bank.
namestringName of the Beneficiary.
amountdecimalAmount of the Credit Transfer in Euro. (Amount must be more than 0.01 and less than 999999999.99)
remittanceInformationstring""Remittance Information (Purpose-/reference text). (optional)
typeOfRemittanceTypeOfRemittanceTypeOfRemittance. UnstructuredType of remittance information. Either structured (e.g. ISO 11649 RF Creditor Reference) and max. 35 chars or unstructured and max. 140 chars.
purposeOfCreditTransferstring""Purpose of the Credit Transfer (optional)
messageToGirocodeUserstring""Beneficiary to originator information. (optional)
versionGirocodeVersionGirocodeVersion. Version1Girocode version. Either 001 or 002. Default: 001.
encodingGirocodeEncodingGirocodeEncoding. ISO_8859_1Encoding of the Girocode payload. Default: ISO-8859-1

Good to know

Important: As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().

Girocode competes (atleast for German-speaking countries) with the Bezahlcode. Even if Girocode has less features, it is more common than Bezahlcode. So choose the right payload type in respect of your users and the features you want to use.


3.8 Mail

Classname/Classfile: Mail / PayloadGenerator.cs

When to use?

Use it when you want to prepare/compose an email. Once scanned the code opens the default mail client with the given information like receiver, subject and message.

How to use it - simple way

Mailgenerator=newMail("john@doe.com","Look at this!","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is one overload:

Overload 1
Description: Creates a new mail with optional subject and body/message.

Parameter nameTypeDefaultDescription
mailReceiverstringnullReceiver's email address
subjectstringnullSubject line of the email
messagestringnullMessage content of the email
encodingMailEncodingMailEncoding.MAILTOPayload encoding type. Choose dependent on your QR Code scanner app.

Good to know

n/a


3.9 MMS

Classname/Classfile: MMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a MMS (message). You can choose if you want to prepare the message or just let the QR code open the messaging app with the correct phonenumber.

How to use it - simple way

MMSgenerator=newMMS("+491701234567","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new MMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingMMSEncodingMMSEncoding.MMSEncoding type

Overload 2
Description: (Pre-)composes a new MMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the MMS
encodingMMSEncodingMMSEncoding.MMSEncoding type

Good to know

This payload type supports (as some of the other payload types, too) different output formats. In most cases/regions you should use the MMSEncoding.MMS-type.


3.10 Monero address/payment

Classname/Classfile: MoneroTransaction / PayloadGenerator.cs

When to use?

This payload opens the user's Monero client/app and prefills its dialog with the given data. Either you pass only the Monero address or you add complete payment/transaction details.

How to use it - simple way

MoneroTransactiongenerator=newMoneroTransaction("46BeWrHpwXmHDpDEUmZBWZfoQpdc6HaERCNmx1pEYL2rAcuwufPN9rXHHtyUA4QVy66qeFQkn6sfK8aHYjA3jk3o1Bv16em");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a Monero payload.

Parameter nameTypeDefaultDescription
addressstringReceiver's monero address
txAmountfloat?nullAmount to transfer
txPaymentIdstringnullPayment id
recipientNamestringnullReceipient's name
txDescriptionstringnullReference text / payment description

Good to know

n/a


3.11 One-Time-Password

Classname/Classfile: OneTimePassword / PayloadGenerator.cs

When to use?

This payload generates a one-time-password QR code which is used for credential-exchange and authentification. You may use it in combination with the Google Authenticator.

How to use it - simple way

OneTimePasswordgenerator=newOneTimePassword(){Secret="pwq6 5q55",Issuer="Google",Label="test@google.com",};stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 0 special overloads. As can be seen in the example above these generator takes it values via properties.

Property nameTypeDefaultDescription
TypeOneTimePassword AuthTypeOneTimePasswordAuth Type.TOTPType of the one-time-password. Either TOTP or HOTP
AlgorithmOoneTimePassword AuthAlgorithmOoneTimePasswordAuth Algorithm.SHA1Algorith of the one-time-password. Either SHA1, SHA256 or SHA512
IssuerstringThe issuer's name
SecretstringThe Base32 encoded secret key
LabelstringThe label
Digitsint6Number of digits
Counterint?nullShall a counter be used?
Periodint?30Valid period

Good to know

The payload generator builds the correct payload for you, but it can't/doesn't calculate the TOTP/HOTP secret for you.


3.12 Phonenumber

Classname/Classfile: PhoneNumber / PayloadGenerator.cs

When to use?

Use it, when you wan't to share a phonenumber or when you want to use the QR code as CTA (call-to-action). Once scanned, the code opens the dialer app on the phone.

How to use it - simple way

PhoneNumbergenerator=newPhoneNumber("+491701234567");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a phone call payload.

Parameter nameTypeDefaultDescription
numberstringPhonenumber of the receiver

Good to know

There is no right or wrong formatting of the given phonenumber. Type the number in this way, you would type it into your phone's dialer.


3.13 RussiaPaymentOrder

Classname/Classfile: RussiaPaymentOrder / PayloadGenerator.cs

When to use?

Use it to generate QR codes for payments in Russia that are compliant to the standard ГОСТ Р 56042-2014.

How to use it - simple way

varaccount="40702810138250123017";varbic="044525225";varbankName="ОАО \"БАНК\"";varname="ООО «Три кита»";varcorrespAcc="30101810965770000413";vargenerator=newPayloadGenerator.RussiaPaymentOrder(name,account,bankName,bic,correspAcc);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(3);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a RussiaPaymentOrder configuration QR code payload.

Parameter nameTypeDefaultDescription
namestringName of the payee (Наименование получателя платежа)
personalAccstringBeneficiary account number (Номер счета получателя платежа)
bankNamestringName of the beneficiary's bank (Наименование банка получателя платежа)
BICstringBIC (БИК)
correspAccstringnullBox number / account payee's bank (Номер кор./сч. банка получателя платежа)
optionalFieldsOptionalFieldsnullOptional additional fields/information
characterSetCharacterSetsCharacterSets.utf_8Encoding of the payload string

Good to know

  • If CharacterSets was set to windows-1251 or koi8-r you should use ToBytes() instead of ToString() and pass the byte-array directly to CreateQrCode()!
  • The maximum length of a RussiaPaymentOrder is 300 byte as defined by the offical standard. Thus it isn't possible to use all additional fields at the same time.

3.14 Shadowsocks configuration

Classname/Classfile: ShadowSocksConfig / PayloadGenerator.cs

When to use?

Use it to share ShadowSocks (Proxy) configurations. When scanned, the QR scanner app should start the ShadowSocks with the given configuration.

How to use it - simple way

ShadowSocksConfiggenerator=newShadowSocksConfig("45.78.47.87",443,"laozhang",ShadowSocksConfig.Method.Aes256Cb);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a ShadowSocks configuration QR code payload.

Parameter nameTypeDefaultDescription
hostnamestringHostname of the ShadowSocks proxy
portintPort of the ShadowSocks proxy
passwordstringPassword of the SS proxy
methodMethodEncryption type
tagstringnullOptional tag line

Good to know

The value of port must be in the range within 1 and 65535. The tag parameter is optional.


3.15 Skype call

Classname/Classfile: SkypeCall / PayloadGenerator.cs

When to use?

Use it when you want to initiate Skype calls. When scanned, the QR scanner app opens skype and calls the user given to the payload generator.

How to use it - simple way

SkypeCallgenerator=newSkypeCall("johndoe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a skype call action payload.

Parameter nameTypeDefaultDescription
skypeUsernamestringSkype username which will be called

Good to know

n/a


3.16 SlovenianUpnQr

Classname/Classfile: SlovenianUpnQr / PayloadGenerator.cs

When to use?

Used for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order)

How to use it - simple way

varpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,recipientSiModel,recipientSiReference,code);//or if you need requested date of debitor’s payment (payment deadline) includedvarpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,deadline,recipientSiModel,recipientSiReference,code);QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);BitmapqrCodeImage=qrCode.GetGraphic(5);qrCodeImage.Save(@"GeneratedQRCode.bmp");

Parameter table

Parameter nameTypeMax LengthDefaultDescription
payerNamestring33Debitor (payer) name
payerAddressstring33Debitor (payer) address (Street name and house number)
payerPlacestring33Debitor (payer) place (Postal code and name)
recipientNamestring33Creditor (payee) name
recipientAddressstring33Creditor (payee) address (Street name and house number)
recipientPlacestring33Creditor (payee) place (Postal code and name)
recipientIbanstring34Creditor's IBAN
descriptionstring42Description/Comment
amountdoubleAmount (in EUR)
deadlineDateTime?Requested date of debitor's payment
recipientSiModelstring4SI99SI model
recipientSiReferencestring22SI reference
codestring4OTHRPurpose of Payment Code

Good to know

Important: As per official specification Slovenian UPN QR codes have to be generated with ECC-Level M (15%), ECI Mode set to ISO8859-2, Byte mode and QR Version of 15. If you pass the Payload-class itself to the QRCoder (as shown in the last example) then you don't have to set this parameters, since the Payload-class does this automatically.


3.17 SMS

Classname/Classfile: SMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a SMS (message). You can choose if you want to create the message including text or just let the QR code open the messaging app with the given phonenumber.

How to use it - simple way

SMSgenerator=newSMS("+491701234567","Hi John, do you remember SMS?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new SMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingSMSEncodingSMSEncoding.SMSEncoding type

Overload 2
Description: (Pre-)composes a new SMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the SMS
encodingSMSEncodingSMSEncoding.SMSEncoding type

Good to know

This payload supports different output formats. In most cases/regions you should use the SMSEncoding.SMS-type, which should work with the most scanner apps.


3.18 SwissQrCode (ISO-20022)

Classname/Classfile: SwissQRCode / PayloadGenerator.cs

When to use?

Opens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein). Note: Take care of the advices from the "Good to know" section.

How to use it - simple way

SwissQrCode.ContactcontactGeneral=SwissQrCode.Contact.WithStructuredAddress("John Doe","3003","Bern","CH","Parlamentsgebäude","1");SwissQrCode.Ibaniban=newSwissQrCode.Iban("CH2609000000857666015",PayloadGenerator.SwissQrCode.Iban.IbanType.QrIban);SwissQrCode.Referencereference=newSwissQrCode.Reference(SwissQrCode.Reference.ReferenceType.QRR,"990005000000000320071012303",SwissQrCode.Reference.ReferenceTextType.QrReference);SwissQrCode.AdditionalInformationadditionalInformation=newSwissQrCode.AdditionalInformation("This is my unstructured message.","Some bill information here...");SwissQrCode.Currencycurrency=SwissQrCode.Currency.CHF;decimalamount=100.25m;SwissQrCodepayload=newSwissQrCode(iban,currency,contactGeneral,additionalInformation,reference,null,amount,null,null);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20,Color.Black,Color.White,(Bitmap)Bitmap.FromFile(Application.StartupPath+"\\CH-Kreuz_7mm.png"),14,1);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a new Swiss Qr code.

Parameter nameTypeDefaultDescription
ibanIbanIBAN object
currencyCurrencyCurrency (either EUR or CHF)
creditorContactCreditor (payee) information
referenceReferenceReference information
additionalInformationAdditionalInformationnullAdditional information texts
debitorContactnullDebitor (payer) information
amountdecimal?nullAmount
requestedDateOfPaymentDateTime?nullObsoleteRequested date of debitor's payment
ultimateCreditorContactnullUltimate creditor information (use only in consultation with your bank!)
alternativeProcedure1stringnullOptional command for alternative processing mode - line 1
alternativeProcedure2stringnullOptional command for alternative processing mode - line 2

Good to know

  • Important: As per official specification Swiss QR codes have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().
  • Important: As per official specification a Swiss cross logo (can be downloaded here) has to be drawn on the code with a size of ~14%. (Per spec the Swiss cross has to be 7mm per side and the Swiss Qr code should be printed with 46mm without quiet zones or 49,2mm per side with quietzones. So we get 7/(49,2/100) = 14% icon size.)

3.19 URL

Classname/Classfile: Url / PayloadGenerator.cs

When to use?

Use it to share links/websites.

How to use it - simple way

Urlgenerator=newUrl("https://github.com/codebude/QRCoder/");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a link payload.

Parameter nameTypeDefaultDescription
urlstringLink url target

Good to know

If you a domain (without http:// or https://) is given, the payload generater prefixes the given url with http://.


3.20 WhatsAppMessage

Classname/Classfile: WhatsAppMessage / PayloadGenerator.cs

When to use?

Use it to share your WhatApp pre-composed WhatsAppMessages. Once scanned, the QR code opens a WhatsApp chat with the given message.

How to use it - simple way

WhatsAppMessagegenerator=newWhatsAppMessage("Hi John, what do you think about QR codes?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new WhatsApp message.

Parameter nameTypeDefaultDescription
messagestringThe message text

Overload 2
Description: Generates a new WhatsApp message towards a given contact.

Parameter nameTypeDefaultDescription
numberstringRecipient/contact number
messagestringThe message text

Good to know

-/-


3.21 WiFi

Classname/Classfile: WiFi / PayloadGenerator.cs

When to use?

Use it when you want to share WiFi credentials. Good for meetings, house partys and conventions.

How to use it - simple way

WiFigenerator=newWiFi("My-WiFis-Name","s3cr3t-p4ssw0rd",WiFi.Authentication.WPA);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates WiFi login credentials.

Parameter nameTypeDefaultDescription
ssidstringSSID of the WiFi network
passwordstringPassword of the WiFi network
authenticationModeAuthenticationAuthentification mode (WEP, WPA, WPA2)
isHiddenSSIDboolfalseSet flag to true, if the WiFi network hides its SSID
escapeHexStringsbooltrueSet flag to false, if SSID/password shouldn't be escaped, even if passed as HEX string

Good to know

  • Don't get confused when choosing authenticationMode-parameter. The value WiFi.Authentication.WPA also includes not only WPA but also WPA2!
  • For widest compatibility you may set escapeHexStrings to false, because if SSID/password are provided in HEX style ([A-F0-9] and will be escaped, the QR code may become unreadable by Apple devices. More info: )

4. Development of own payload types

Implementing your own, custom payload generator is quite easy. Simply create a new class for your custom payload and implement the QRCoder.PayloadGenerator.Payload-interface. The only method you have to implement/override is the ToString()-method.

publicclassHelloWorldPayload:Payload{privatestring_name;publicHelloWorldPayload(stringname){_name=name;}publicoverridestringToString(){return$"Hello {_name}";}}

If you have written a cool generator, feel free to send it in as PullRequest.

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Advanced usage Payload generators

Raffael Herrmann edited this page May 22, 2024 · 32 revisions
  1. Introduction to the "Payload Generator"
  2. Overview of the different payload types
  3. Usage of the payload generators
    3.1 BezahlCode
    3.2 Crypto Payment Address (e.g. Bitcoin, Litecoin, ...)
    3.3 Bookmark
    3.4 Calendar events (iCal/vEvent)
    3.5 ContactData (MeCard/vCard)
    3.6 Geolocation
    3.7 Girocode
    3.8 Mail
    3.9 MMS
    3.10 Monero address/payment
    3.11 One-Time-Password
    3.12 Phonenumber
    3.13 Russia Payment Order
    3.14 Shadowsocks configuration
    3.15 Skype call
    3.16 Slovenian QR Code for UPN QR Forms
    3.17 SMS
    3.18 SwissQrCode (ISO-20022)
    3.19 URL
    3.20 WhatsAppMessage
    3.21 WiFi
  4. Development of own payload types

1. Introduction to the "Payload Generator"

The payload generator is one of the things, which make the QRCoder unique. It's a class which helps to generate special payloads (=the text encoded in QR codes) that will start different actions on the device which scans the QR code.

Indeed a QR code can only encode a string (of text), but if this string has a special format, most* QR code scanners will perform a predefined action.

To help you to create these special formatted payload strings, we implemented the payload generators. These are easy-to-use classes, which check your data for invalid inputs and "automagically" create the fitting payload strings for you.

Info:Keep in mind, that all payload types stand and fall with the commitment between QR encoders and QR scanner apps. Special payload types aren't defined in the QR code standard (ISO/IEC 18004). Most of the QR code scanner apps are able to interpret the payload types described on this page. But in a real world application you should test your QR codes against the scanners your users will use.


2. Overview of the different payload types

Right now there are 19 different payload generators. To get a quick overview, have a look at the following table.

(Class-)NameWhat does it do, when scanned?Specification
BezahlCodeOpens the banking app for bank transfers, debits and banker's order. It's common in German-speaking countries and competes with the more common GiroCode.Bezahlcode specification
Bitcoin(LikeCryptoCurrency)AddressStarts crypto currency app for transfers.BIP 0021
BookmarkSaves a bookmark to the default webbrowser.NTTdocomo MEBKM
CalendarEventAdds an event to the user's calendar. Supports iCal and vEvent format.RFC 5545
ContactDataAdds a contact to the user's address book. Supports MeCard, vCard 2.1, vCard 3.0 and vCard 4.0 format.NTTdocomo MeCard, RFC 2425 (vCard 2.1), RFC 2426 (vCard 3.0), RFC 6350 (vCard 4.0)
GeolocationOpens the maps app and shows the given location or opens Google Maps in browser.RFC 5870
GirocodeOpens the banking app for bank transfers. It's common in the European region and competes with the less common BezahlCode.EPC069-12
MailOpens the default email app and composes a new message. Supports mailto:, MATMSG: and smtp: format.RFCRFC 6068, NTTdocomo MATMSG, smtp URI scheme
MMSOpens the standard messaging app and composes a new MMS. Either in mmsto: or in mms: format.RFC draft (mmsto), Data Services: Whitepaper (mms)
MoneroTransactionOpens the Monero wallet with transaction details.Monero URI scheme
OneTimePasswordEncoded secret keys. May be used in combination with Google Authenticator for example.Key URI Format
PhoneNumberOpens the phone's dialer app with given number.RFC 3966
ShadowSocksConfigOpens ShadowSocks app with given configuration.ShadowSocks URI scheme
SkypeCallOpens Skype app and calls given contact.Skype URI API reference
SlovenianUpnQrUsed for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order).Technical description, Advice for programmers
SMSOpen SMS app and composes new message. Supports sms:, sms: (for iOS) and SMSTO: format.RFC 5724 (sms), sms URI for iOS, SMSTO (not common)
SwissQrCodeOpens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein).ISO 20022
UrlOpens the given URL in default webbrowser.RFC 3986
WhatsAppMessageOpen whatsapp, lets you choose a contact and composes a new message with given text.WhatsApp URL Scheme
WiFiWhen scanned, the scanning device can login to the given WiFi without typing the credentials.Short description

3. Usage of the payload generators

3.1 BezahlCode

Classname/Classfile: BezahlCode / PayloadGenerator.cs

When to use?

Use it for banking (inlcuding bank transfers, debits, bank contacts and banker's order). It's used in German-speaking countries and competes with the more common GiroCode.

How to use it - simple way

The following code generates a payload for a simple SEPA payment to Wikimedia.

BezahlCodegenerator=newBezahlCode(BezahlCode.AuthorityType.singlepaymentsepa,"Wikimedia",iban:"DE33100205000001194700",bic:"BFSWDE33BER",amount:25.00m);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are four overloads:

Overload 1
Description: Creates a payload for SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 2
Description: Creates a payload for non SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 3
Description: Creates a payload for exchange of bank/payment contact data

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstring""Bank account (Kontonummer)
bncstring""Bank institute (Bankleitzahl)
ibanstring""IBAN
bicstring""BIC
reasonstring""Reason (Verwendungszweck)

Overload 4
Description: Generic constructor used by overload 1 and 2.

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)
internalModeint0Only used for internal state handdling

Good to know

BezahlCode is a format which competes with the GiroCode. Both can be used for banking purposes but GiroCode is a little more common and newer. Nevertheless BezahlCode has some more features like periodic transfer and debits. So before choose one of both, check which one fits your needs and which one is better supported by your users and their QR code scanner apps.


3.2 (Bitcoin like) Crypto Currency Payment Address

Classname/Classfile: BitcoinAddress|BitcoinCashAddress|LitecoinAddress / PayloadGenerator.cs

When to use?

Use this payload to share Bitcoin/Bitcoin Cash/Litecoin addresses or initiate payments in one of those currencies.

How to use it - simple way

BitcoinAddressgenerator=newPayloadGenerator.BitcoinAddress("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W",1.5d);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a Bitcoin address with or without amount to transfer and message.

Parameter nameTypeDefaultDescription
addressstringBitcoin address of the payment receiver
amountdouble?Amount of Bitcoins to transfer
labelstringnullReference label
messagestringnullReferece text aka message

Good to know

If you want to share only the crypto currency address without any amount of coins, set the variable amount to null. Replace "Bitcoin" by "BitcoinCash" or "Litecoin" to generate payloads for those currencies.


3.3 Bookmark

Classname/Classfile: Bookmark / PayloadGenerator.cs

When to use?

Use this payload, when you want to place a bookmark in the user's default webbrowser.

How to use it - simple way

Bookmarkgenerator=newBookmark("http://code-bude.net","Blog of QRCoder's father");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a bookmark payload including the bookmark title.

Parameter nameTypeDefaultDescription
urlstringUrl of the bookmark
titlestringTitle of the bookmark

Good to know

n/a


3.4 Calendar events (iCal/vEvent)

Classname/Classfile: CalendarEvent / PayloadGenerator.cs

When to use?

Use this payload to place an event to the user's calendar application.

How to use it - simple way

CalendarEventgenerator=newCalendarEvent("Birthday party","Join QRCoder's fourth birthday!","51.26118,6.6717",newDateTime(2017,10,13),newDateTime(2017,10,13),true);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeStart time of the event
endDateTimeEnd time of the event
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Overload 2
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeOffsetStart time of the event incl. offset in relation to UTC
endDateTimeOffsetEnd time of the event incl. offset in relation to UTC
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Good to know

The parameters description and location are optional. They can be set to null or string.Empty. If you want to place an event to Apple users you should use iCal instead of Universal as encoding.


3.5 ContactData (MeCard/vCard)

Classname/Classfile: ContactData / PayloadGenerator.cs

When to use?

Use it, when you want to share contact data/business cards. A QR code with this payload type will add the contact data to the user's address book.

How to use it - simple way

ContactDatagenerator=newContactData(ContactData.ContactOutputType.VCard3,"John","Doe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates contact data payload in different formats.

Parameter nameTypeDefaultDescription
outputTypeContactOutputTypePayload output type
firstnamestringThe firstname
lastnamestringThe lastname
nicknamestringnullThe displayname
phonestringnullNormal phone number
mobilePhonestringnullMobile phone
workPhonestringnullOffice phone number
emailstringnullE-Mail address
birthdayDateTime?nullBirthday
websitestringnullWebsite / Homepage
streetstringnullStreet
houseNumberstringnullHousenumber
citystringnullCity
zipCodestringnullZip code
countrystringnullCountry
notestringnullMemo text / notes
stateRegionstringnullState / Region
addressOrderAddressOrderAddressOrder.Defaultenum to define address order (see below)
orgstringnullOrganization/Company
orgTitlestringnullOrganization/Company title

Good to know

Via the parameter outputType you can choose between different formats. Supported formats are: vCard 2.1, vCard 3.0, vCard 4.0 and MeCard. Choose the format which fits your needs. Right now vCard 3.0 is the most used format.

The addressOrderenum specifies in which format the address is rendered. The two options are:

  • Default
    The address format used in European countries and others.
    Sample

    John Doe
    Königsallee 1
    40210 Düsseldorf
    Germany

  • Reversed
    The address format used in North America and others.
    Sample

    John Doe
    123 Fake St.
    Cleveland, OH, 12345
    USA


3.6 Geolocation

Classname/Classfile: Geolocation / PayloadGenerator.cs

When to use?

Use this payload type when you want to share a location. You can choose between the geo-format and Google Maps links.

How to use it - simple way

Geolocationgenerator=newGeolocation("51.26118","6.6717");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: The payload encodes a (geo-)location by its coordinates.

Parameter nameTypeDefaultDescription
latitudestringLatitude with . as splitter
longitudestringLongitude with . as splitter
encodingGeolocationEncodingGeolocationEncoding.GEOEncoding type - GEO or GoogleMaps

Good to know

If you use the geo-format the QR scanner app must support this tag. Most scanners do so. But if you want to be 100% on the safe side, choose Google Maps format because this generates a Google Maps (web-)link which can be interpreted by nearly any QR code scanner.


3.7 Girocode

Classname/Classfile: Girocode / PayloadGenerator.cs

When to use?

Use this payload type if you want to share payment contact information and/or bank transfer data. The Girocode is an European standard and supports SEPA payments.

How to use it - simple way

varpayload=newGirocode("DE33100205000001194700","BFSWDE33BER","Wikimedia",1337.99m);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates the Girocode payload with different options.

Parameter nameTypeDefaultDescription
ibanstringAccount number of the Beneficiary. Only IBAN is allowed.
bicstringBIC of the Beneficiary Bank.
namestringName of the Beneficiary.
amountdecimalAmount of the Credit Transfer in Euro. (Amount must be more than 0.01 and less than 999999999.99)
remittanceInformationstring""Remittance Information (Purpose-/reference text). (optional)
typeOfRemittanceTypeOfRemittanceTypeOfRemittance. UnstructuredType of remittance information. Either structured (e.g. ISO 11649 RF Creditor Reference) and max. 35 chars or unstructured and max. 140 chars.
purposeOfCreditTransferstring""Purpose of the Credit Transfer (optional)
messageToGirocodeUserstring""Beneficiary to originator information. (optional)
versionGirocodeVersionGirocodeVersion. Version1Girocode version. Either 001 or 002. Default: 001.
encodingGirocodeEncodingGirocodeEncoding. ISO_8859_1Encoding of the Girocode payload. Default: ISO-8859-1

Good to know

Important: As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().

Girocode competes (atleast for German-speaking countries) with the Bezahlcode. Even if Girocode has less features, it is more common than Bezahlcode. So choose the right payload type in respect of your users and the features you want to use.


3.8 Mail

Classname/Classfile: Mail / PayloadGenerator.cs

When to use?

Use it when you want to prepare/compose an email. Once scanned the code opens the default mail client with the given information like receiver, subject and message.

How to use it - simple way

Mailgenerator=newMail("john@doe.com","Look at this!","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is one overload:

Overload 1
Description: Creates a new mail with optional subject and body/message.

Parameter nameTypeDefaultDescription
mailReceiverstringnullReceiver's email address
subjectstringnullSubject line of the email
messagestringnullMessage content of the email
encodingMailEncodingMailEncoding.MAILTOPayload encoding type. Choose dependent on your QR Code scanner app.

Good to know

n/a


3.9 MMS

Classname/Classfile: MMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a MMS (message). You can choose if you want to prepare the message or just let the QR code open the messaging app with the correct phonenumber.

How to use it - simple way

MMSgenerator=newMMS("+491701234567","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new MMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingMMSEncodingMMSEncoding.MMSEncoding type

Overload 2
Description: (Pre-)composes a new MMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the MMS
encodingMMSEncodingMMSEncoding.MMSEncoding type

Good to know

This payload type supports (as some of the other payload types, too) different output formats. In most cases/regions you should use the MMSEncoding.MMS-type.


3.10 Monero address/payment

Classname/Classfile: MoneroTransaction / PayloadGenerator.cs

When to use?

This payload opens the user's Monero client/app and prefills its dialog with the given data. Either you pass only the Monero address or you add complete payment/transaction details.

How to use it - simple way

MoneroTransactiongenerator=newMoneroTransaction("46BeWrHpwXmHDpDEUmZBWZfoQpdc6HaERCNmx1pEYL2rAcuwufPN9rXHHtyUA4QVy66qeFQkn6sfK8aHYjA3jk3o1Bv16em");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a Monero payload.

Parameter nameTypeDefaultDescription
addressstringReceiver's monero address
txAmountfloat?nullAmount to transfer
txPaymentIdstringnullPayment id
recipientNamestringnullReceipient's name
txDescriptionstringnullReference text / payment description

Good to know

n/a


3.11 One-Time-Password

Classname/Classfile: OneTimePassword / PayloadGenerator.cs

When to use?

This payload generates a one-time-password QR code which is used for credential-exchange and authentification. You may use it in combination with the Google Authenticator.

How to use it - simple way

OneTimePasswordgenerator=newOneTimePassword(){Secret="pwq6 5q55",Issuer="Google",Label="test@google.com",};stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 0 special overloads. As can be seen in the example above these generator takes it values via properties.

Property nameTypeDefaultDescription
TypeOneTimePassword AuthTypeOneTimePasswordAuth Type.TOTPType of the one-time-password. Either TOTP or HOTP
AlgorithmOoneTimePassword AuthAlgorithmOoneTimePasswordAuth Algorithm.SHA1Algorith of the one-time-password. Either SHA1, SHA256 or SHA512
IssuerstringThe issuer's name
SecretstringThe Base32 encoded secret key
LabelstringThe label
Digitsint6Number of digits
Counterint?nullShall a counter be used?
Periodint?30Valid period

Good to know

The payload generator builds the correct payload for you, but it can't/doesn't calculate the TOTP/HOTP secret for you.


3.12 Phonenumber

Classname/Classfile: PhoneNumber / PayloadGenerator.cs

When to use?

Use it, when you wan't to share a phonenumber or when you want to use the QR code as CTA (call-to-action). Once scanned, the code opens the dialer app on the phone.

How to use it - simple way

PhoneNumbergenerator=newPhoneNumber("+491701234567");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a phone call payload.

Parameter nameTypeDefaultDescription
numberstringPhonenumber of the receiver

Good to know

There is no right or wrong formatting of the given phonenumber. Type the number in this way, you would type it into your phone's dialer.


3.13 RussiaPaymentOrder

Classname/Classfile: RussiaPaymentOrder / PayloadGenerator.cs

When to use?

Use it to generate QR codes for payments in Russia that are compliant to the standard ГОСТ Р 56042-2014.

How to use it - simple way

varaccount="40702810138250123017";varbic="044525225";varbankName="ОАО \"БАНК\"";varname="ООО «Три кита»";varcorrespAcc="30101810965770000413";vargenerator=newPayloadGenerator.RussiaPaymentOrder(name,account,bankName,bic,correspAcc);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(3);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a RussiaPaymentOrder configuration QR code payload.

Parameter nameTypeDefaultDescription
namestringName of the payee (Наименование получателя платежа)
personalAccstringBeneficiary account number (Номер счета получателя платежа)
bankNamestringName of the beneficiary's bank (Наименование банка получателя платежа)
BICstringBIC (БИК)
correspAccstringnullBox number / account payee's bank (Номер кор./сч. банка получателя платежа)
optionalFieldsOptionalFieldsnullOptional additional fields/information
characterSetCharacterSetsCharacterSets.utf_8Encoding of the payload string

Good to know

  • If CharacterSets was set to windows-1251 or koi8-r you should use ToBytes() instead of ToString() and pass the byte-array directly to CreateQrCode()!
  • The maximum length of a RussiaPaymentOrder is 300 byte as defined by the offical standard. Thus it isn't possible to use all additional fields at the same time.

3.14 Shadowsocks configuration

Classname/Classfile: ShadowSocksConfig / PayloadGenerator.cs

When to use?

Use it to share ShadowSocks (Proxy) configurations. When scanned, the QR scanner app should start the ShadowSocks with the given configuration.

How to use it - simple way

ShadowSocksConfiggenerator=newShadowSocksConfig("45.78.47.87",443,"laozhang",ShadowSocksConfig.Method.Aes256Cb);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a ShadowSocks configuration QR code payload.

Parameter nameTypeDefaultDescription
hostnamestringHostname of the ShadowSocks proxy
portintPort of the ShadowSocks proxy
passwordstringPassword of the SS proxy
methodMethodEncryption type
tagstringnullOptional tag line

Good to know

The value of port must be in the range within 1 and 65535. The tag parameter is optional.


3.15 Skype call

Classname/Classfile: SkypeCall / PayloadGenerator.cs

When to use?

Use it when you want to initiate Skype calls. When scanned, the QR scanner app opens skype and calls the user given to the payload generator.

How to use it - simple way

SkypeCallgenerator=newSkypeCall("johndoe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a skype call action payload.

Parameter nameTypeDefaultDescription
skypeUsernamestringSkype username which will be called

Good to know

n/a


3.16 SlovenianUpnQr

Classname/Classfile: SlovenianUpnQr / PayloadGenerator.cs

When to use?

Used for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order)

How to use it - simple way

varpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,recipientSiModel,recipientSiReference,code);//or if you need requested date of debitor’s payment (payment deadline) includedvarpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,deadline,recipientSiModel,recipientSiReference,code);QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);BitmapqrCodeImage=qrCode.GetGraphic(5);qrCodeImage.Save(@"GeneratedQRCode.bmp");

Parameter table

Parameter nameTypeMax LengthDefaultDescription
payerNamestring33Debitor (payer) name
payerAddressstring33Debitor (payer) address (Street name and house number)
payerPlacestring33Debitor (payer) place (Postal code and name)
recipientNamestring33Creditor (payee) name
recipientAddressstring33Creditor (payee) address (Street name and house number)
recipientPlacestring33Creditor (payee) place (Postal code and name)
recipientIbanstring34Creditor's IBAN
descriptionstring42Description/Comment
amountdoubleAmount (in EUR)
deadlineDateTime?Requested date of debitor's payment
recipientSiModelstring4SI99SI model
recipientSiReferencestring22SI reference
codestring4OTHRPurpose of Payment Code

Good to know

Important: As per official specification Slovenian UPN QR codes have to be generated with ECC-Level M (15%), ECI Mode set to ISO8859-2, Byte mode and QR Version of 15. If you pass the Payload-class itself to the QRCoder (as shown in the last example) then you don't have to set this parameters, since the Payload-class does this automatically.


3.17 SMS

Classname/Classfile: SMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a SMS (message). You can choose if you want to create the message including text or just let the QR code open the messaging app with the given phonenumber.

How to use it - simple way

SMSgenerator=newSMS("+491701234567","Hi John, do you remember SMS?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new SMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingSMSEncodingSMSEncoding.SMSEncoding type

Overload 2
Description: (Pre-)composes a new SMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the SMS
encodingSMSEncodingSMSEncoding.SMSEncoding type

Good to know

This payload supports different output formats. In most cases/regions you should use the SMSEncoding.SMS-type, which should work with the most scanner apps.


3.18 SwissQrCode (ISO-20022)

Classname/Classfile: SwissQRCode / PayloadGenerator.cs

When to use?

Opens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein). Note: Take care of the advices from the "Good to know" section.

How to use it - simple way

SwissQrCode.ContactcontactGeneral=SwissQrCode.Contact.WithStructuredAddress("John Doe","3003","Bern","CH","Parlamentsgebäude","1");SwissQrCode.Ibaniban=newSwissQrCode.Iban("CH2609000000857666015",PayloadGenerator.SwissQrCode.Iban.IbanType.QrIban);SwissQrCode.Referencereference=newSwissQrCode.Reference(SwissQrCode.Reference.ReferenceType.QRR,"990005000000000320071012303",SwissQrCode.Reference.ReferenceTextType.QrReference);SwissQrCode.AdditionalInformationadditionalInformation=newSwissQrCode.AdditionalInformation("This is my unstructured message.","Some bill information here...");SwissQrCode.Currencycurrency=SwissQrCode.Currency.CHF;decimalamount=100.25m;SwissQrCodepayload=newSwissQrCode(iban,currency,contactGeneral,additionalInformation,reference,null,amount,null,null);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20,Color.Black,Color.White,(Bitmap)Bitmap.FromFile(Application.StartupPath+"\\CH-Kreuz_7mm.png"),14,1);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a new Swiss Qr code.

Parameter nameTypeDefaultDescription
ibanIbanIBAN object
currencyCurrencyCurrency (either EUR or CHF)
creditorContactCreditor (payee) information
referenceReferenceReference information
additionalInformationAdditionalInformationnullAdditional information texts
debitorContactnullDebitor (payer) information
amountdecimal?nullAmount
requestedDateOfPaymentDateTime?nullObsoleteRequested date of debitor's payment
ultimateCreditorContactnullUltimate creditor information (use only in consultation with your bank!)
alternativeProcedure1stringnullOptional command for alternative processing mode - line 1
alternativeProcedure2stringnullOptional command for alternative processing mode - line 2

Good to know

  • Important: As per official specification Swiss QR codes have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().
  • Important: As per official specification a Swiss cross logo (can be downloaded here) has to be drawn on the code with a size of ~14%. (Per spec the Swiss cross has to be 7mm per side and the Swiss Qr code should be printed with 46mm without quiet zones or 49,2mm per side with quietzones. So we get 7/(49,2/100) = 14% icon size.)

3.19 URL

Classname/Classfile: Url / PayloadGenerator.cs

When to use?

Use it to share links/websites.

How to use it - simple way

Urlgenerator=newUrl("https://github.com/codebude/QRCoder/");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a link payload.

Parameter nameTypeDefaultDescription
urlstringLink url target

Good to know

If you a domain (without http:// or https://) is given, the payload generater prefixes the given url with http://.


3.20 WhatsAppMessage

Classname/Classfile: WhatsAppMessage / PayloadGenerator.cs

When to use?

Use it to share your WhatApp pre-composed WhatsAppMessages. Once scanned, the QR code opens a WhatsApp chat with the given message.

How to use it - simple way

WhatsAppMessagegenerator=newWhatsAppMessage("Hi John, what do you think about QR codes?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new WhatsApp message.

Parameter nameTypeDefaultDescription
messagestringThe message text

Overload 2
Description: Generates a new WhatsApp message towards a given contact.

Parameter nameTypeDefaultDescription
numberstringRecipient/contact number
messagestringThe message text

Good to know

-/-


3.21 WiFi

Classname/Classfile: WiFi / PayloadGenerator.cs

When to use?

Use it when you want to share WiFi credentials. Good for meetings, house partys and conventions.

How to use it - simple way

WiFigenerator=newWiFi("My-WiFis-Name","s3cr3t-p4ssw0rd",WiFi.Authentication.WPA);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates WiFi login credentials.

Parameter nameTypeDefaultDescription
ssidstringSSID of the WiFi network
passwordstringPassword of the WiFi network
authenticationModeAuthenticationAuthentification mode (WEP, WPA, WPA2)
isHiddenSSIDboolfalseSet flag to true, if the WiFi network hides its SSID
escapeHexStringsbooltrueSet flag to false, if SSID/password shouldn't be escaped, even if passed as HEX string

Good to know

  • Don't get confused when choosing authenticationMode-parameter. The value WiFi.Authentication.WPA also includes not only WPA but also WPA2!
  • For widest compatibility you may set escapeHexStrings to false, because if SSID/password are provided in HEX style ([A-F0-9] and will be escaped, the QR code may become unreadable by Apple devices. More info: )

4. Development of own payload types

Implementing your own, custom payload generator is quite easy. Simply create a new class for your custom payload and implement the QRCoder.PayloadGenerator.Payload-interface. The only method you have to implement/override is the ToString()-method.

publicclassHelloWorldPayload:Payload{privatestring_name;publicHelloWorldPayload(stringname){_name=name;}publicoverridestringToString(){return$"Hello {_name}";}}

If you have written a cool generator, feel free to send it in as PullRequest.

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Advanced usage Payload generators

Raffael Herrmann edited this page May 22, 2024 · 32 revisions
  1. Introduction to the "Payload Generator"
  2. Overview of the different payload types
  3. Usage of the payload generators
    3.1 BezahlCode
    3.2 Crypto Payment Address (e.g. Bitcoin, Litecoin, ...)
    3.3 Bookmark
    3.4 Calendar events (iCal/vEvent)
    3.5 ContactData (MeCard/vCard)
    3.6 Geolocation
    3.7 Girocode
    3.8 Mail
    3.9 MMS
    3.10 Monero address/payment
    3.11 One-Time-Password
    3.12 Phonenumber
    3.13 Russia Payment Order
    3.14 Shadowsocks configuration
    3.15 Skype call
    3.16 Slovenian QR Code for UPN QR Forms
    3.17 SMS
    3.18 SwissQrCode (ISO-20022)
    3.19 URL
    3.20 WhatsAppMessage
    3.21 WiFi
  4. Development of own payload types

1. Introduction to the "Payload Generator"

The payload generator is one of the things, which make the QRCoder unique. It's a class which helps to generate special payloads (=the text encoded in QR codes) that will start different actions on the device which scans the QR code.

Indeed a QR code can only encode a string (of text), but if this string has a special format, most* QR code scanners will perform a predefined action.

To help you to create these special formatted payload strings, we implemented the payload generators. These are easy-to-use classes, which check your data for invalid inputs and "automagically" create the fitting payload strings for you.

Info:Keep in mind, that all payload types stand and fall with the commitment between QR encoders and QR scanner apps. Special payload types aren't defined in the QR code standard (ISO/IEC 18004). Most of the QR code scanner apps are able to interpret the payload types described on this page. But in a real world application you should test your QR codes against the scanners your users will use.


2. Overview of the different payload types

Right now there are 19 different payload generators. To get a quick overview, have a look at the following table.

(Class-)NameWhat does it do, when scanned?Specification
BezahlCodeOpens the banking app for bank transfers, debits and banker's order. It's common in German-speaking countries and competes with the more common GiroCode.Bezahlcode specification
Bitcoin(LikeCryptoCurrency)AddressStarts crypto currency app for transfers.BIP 0021
BookmarkSaves a bookmark to the default webbrowser.NTTdocomo MEBKM
CalendarEventAdds an event to the user's calendar. Supports iCal and vEvent format.RFC 5545
ContactDataAdds a contact to the user's address book. Supports MeCard, vCard 2.1, vCard 3.0 and vCard 4.0 format.NTTdocomo MeCard, RFC 2425 (vCard 2.1), RFC 2426 (vCard 3.0), RFC 6350 (vCard 4.0)
GeolocationOpens the maps app and shows the given location or opens Google Maps in browser.RFC 5870
GirocodeOpens the banking app for bank transfers. It's common in the European region and competes with the less common BezahlCode.EPC069-12
MailOpens the default email app and composes a new message. Supports mailto:, MATMSG: and smtp: format.RFCRFC 6068, NTTdocomo MATMSG, smtp URI scheme
MMSOpens the standard messaging app and composes a new MMS. Either in mmsto: or in mms: format.RFC draft (mmsto), Data Services: Whitepaper (mms)
MoneroTransactionOpens the Monero wallet with transaction details.Monero URI scheme
OneTimePasswordEncoded secret keys. May be used in combination with Google Authenticator for example.Key URI Format
PhoneNumberOpens the phone's dialer app with given number.RFC 3966
ShadowSocksConfigOpens ShadowSocks app with given configuration.ShadowSocks URI scheme
SkypeCallOpens Skype app and calls given contact.Skype URI API reference
SlovenianUpnQrUsed for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order).Technical description, Advice for programmers
SMSOpen SMS app and composes new message. Supports sms:, sms: (for iOS) and SMSTO: format.RFC 5724 (sms), sms URI for iOS, SMSTO (not common)
SwissQrCodeOpens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein).ISO 20022
UrlOpens the given URL in default webbrowser.RFC 3986
WhatsAppMessageOpen whatsapp, lets you choose a contact and composes a new message with given text.WhatsApp URL Scheme
WiFiWhen scanned, the scanning device can login to the given WiFi without typing the credentials.Short description

3. Usage of the payload generators

3.1 BezahlCode

Classname/Classfile: BezahlCode / PayloadGenerator.cs

When to use?

Use it for banking (inlcuding bank transfers, debits, bank contacts and banker's order). It's used in German-speaking countries and competes with the more common GiroCode.

How to use it - simple way

The following code generates a payload for a simple SEPA payment to Wikimedia.

BezahlCodegenerator=newBezahlCode(BezahlCode.AuthorityType.singlepaymentsepa,"Wikimedia",iban:"DE33100205000001194700",bic:"BFSWDE33BER",amount:25.00m);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are four overloads:

Overload 1
Description: Creates a payload for SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 2
Description: Creates a payload for non SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 3
Description: Creates a payload for exchange of bank/payment contact data

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstring""Bank account (Kontonummer)
bncstring""Bank institute (Bankleitzahl)
ibanstring""IBAN
bicstring""BIC
reasonstring""Reason (Verwendungszweck)

Overload 4
Description: Generic constructor used by overload 1 and 2.

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)
internalModeint0Only used for internal state handdling

Good to know

BezahlCode is a format which competes with the GiroCode. Both can be used for banking purposes but GiroCode is a little more common and newer. Nevertheless BezahlCode has some more features like periodic transfer and debits. So before choose one of both, check which one fits your needs and which one is better supported by your users and their QR code scanner apps.


3.2 (Bitcoin like) Crypto Currency Payment Address

Classname/Classfile: BitcoinAddress|BitcoinCashAddress|LitecoinAddress / PayloadGenerator.cs

When to use?

Use this payload to share Bitcoin/Bitcoin Cash/Litecoin addresses or initiate payments in one of those currencies.

How to use it - simple way

BitcoinAddressgenerator=newPayloadGenerator.BitcoinAddress("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W",1.5d);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a Bitcoin address with or without amount to transfer and message.

Parameter nameTypeDefaultDescription
addressstringBitcoin address of the payment receiver
amountdouble?Amount of Bitcoins to transfer
labelstringnullReference label
messagestringnullReferece text aka message

Good to know

If you want to share only the crypto currency address without any amount of coins, set the variable amount to null. Replace "Bitcoin" by "BitcoinCash" or "Litecoin" to generate payloads for those currencies.


3.3 Bookmark

Classname/Classfile: Bookmark / PayloadGenerator.cs

When to use?

Use this payload, when you want to place a bookmark in the user's default webbrowser.

How to use it - simple way

Bookmarkgenerator=newBookmark("http://code-bude.net","Blog of QRCoder's father");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a bookmark payload including the bookmark title.

Parameter nameTypeDefaultDescription
urlstringUrl of the bookmark
titlestringTitle of the bookmark

Good to know

n/a


3.4 Calendar events (iCal/vEvent)

Classname/Classfile: CalendarEvent / PayloadGenerator.cs

When to use?

Use this payload to place an event to the user's calendar application.

How to use it - simple way

CalendarEventgenerator=newCalendarEvent("Birthday party","Join QRCoder's fourth birthday!","51.26118,6.6717",newDateTime(2017,10,13),newDateTime(2017,10,13),true);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeStart time of the event
endDateTimeEnd time of the event
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Overload 2
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeOffsetStart time of the event incl. offset in relation to UTC
endDateTimeOffsetEnd time of the event incl. offset in relation to UTC
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Good to know

The parameters description and location are optional. They can be set to null or string.Empty. If you want to place an event to Apple users you should use iCal instead of Universal as encoding.


3.5 ContactData (MeCard/vCard)

Classname/Classfile: ContactData / PayloadGenerator.cs

When to use?

Use it, when you want to share contact data/business cards. A QR code with this payload type will add the contact data to the user's address book.

How to use it - simple way

ContactDatagenerator=newContactData(ContactData.ContactOutputType.VCard3,"John","Doe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates contact data payload in different formats.

Parameter nameTypeDefaultDescription
outputTypeContactOutputTypePayload output type
firstnamestringThe firstname
lastnamestringThe lastname
nicknamestringnullThe displayname
phonestringnullNormal phone number
mobilePhonestringnullMobile phone
workPhonestringnullOffice phone number
emailstringnullE-Mail address
birthdayDateTime?nullBirthday
websitestringnullWebsite / Homepage
streetstringnullStreet
houseNumberstringnullHousenumber
citystringnullCity
zipCodestringnullZip code
countrystringnullCountry
notestringnullMemo text / notes
stateRegionstringnullState / Region
addressOrderAddressOrderAddressOrder.Defaultenum to define address order (see below)
orgstringnullOrganization/Company
orgTitlestringnullOrganization/Company title

Good to know

Via the parameter outputType you can choose between different formats. Supported formats are: vCard 2.1, vCard 3.0, vCard 4.0 and MeCard. Choose the format which fits your needs. Right now vCard 3.0 is the most used format.

The addressOrderenum specifies in which format the address is rendered. The two options are:

  • Default
    The address format used in European countries and others.
    Sample

    John Doe
    Königsallee 1
    40210 Düsseldorf
    Germany

  • Reversed
    The address format used in North America and others.
    Sample

    John Doe
    123 Fake St.
    Cleveland, OH, 12345
    USA


3.6 Geolocation

Classname/Classfile: Geolocation / PayloadGenerator.cs

When to use?

Use this payload type when you want to share a location. You can choose between the geo-format and Google Maps links.

How to use it - simple way

Geolocationgenerator=newGeolocation("51.26118","6.6717");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: The payload encodes a (geo-)location by its coordinates.

Parameter nameTypeDefaultDescription
latitudestringLatitude with . as splitter
longitudestringLongitude with . as splitter
encodingGeolocationEncodingGeolocationEncoding.GEOEncoding type - GEO or GoogleMaps

Good to know

If you use the geo-format the QR scanner app must support this tag. Most scanners do so. But if you want to be 100% on the safe side, choose Google Maps format because this generates a Google Maps (web-)link which can be interpreted by nearly any QR code scanner.


3.7 Girocode

Classname/Classfile: Girocode / PayloadGenerator.cs

When to use?

Use this payload type if you want to share payment contact information and/or bank transfer data. The Girocode is an European standard and supports SEPA payments.

How to use it - simple way

varpayload=newGirocode("DE33100205000001194700","BFSWDE33BER","Wikimedia",1337.99m);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates the Girocode payload with different options.

Parameter nameTypeDefaultDescription
ibanstringAccount number of the Beneficiary. Only IBAN is allowed.
bicstringBIC of the Beneficiary Bank.
namestringName of the Beneficiary.
amountdecimalAmount of the Credit Transfer in Euro. (Amount must be more than 0.01 and less than 999999999.99)
remittanceInformationstring""Remittance Information (Purpose-/reference text). (optional)
typeOfRemittanceTypeOfRemittanceTypeOfRemittance. UnstructuredType of remittance information. Either structured (e.g. ISO 11649 RF Creditor Reference) and max. 35 chars or unstructured and max. 140 chars.
purposeOfCreditTransferstring""Purpose of the Credit Transfer (optional)
messageToGirocodeUserstring""Beneficiary to originator information. (optional)
versionGirocodeVersionGirocodeVersion. Version1Girocode version. Either 001 or 002. Default: 001.
encodingGirocodeEncodingGirocodeEncoding. ISO_8859_1Encoding of the Girocode payload. Default: ISO-8859-1

Good to know

Important: As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().

Girocode competes (atleast for German-speaking countries) with the Bezahlcode. Even if Girocode has less features, it is more common than Bezahlcode. So choose the right payload type in respect of your users and the features you want to use.


3.8 Mail

Classname/Classfile: Mail / PayloadGenerator.cs

When to use?

Use it when you want to prepare/compose an email. Once scanned the code opens the default mail client with the given information like receiver, subject and message.

How to use it - simple way

Mailgenerator=newMail("john@doe.com","Look at this!","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is one overload:

Overload 1
Description: Creates a new mail with optional subject and body/message.

Parameter nameTypeDefaultDescription
mailReceiverstringnullReceiver's email address
subjectstringnullSubject line of the email
messagestringnullMessage content of the email
encodingMailEncodingMailEncoding.MAILTOPayload encoding type. Choose dependent on your QR Code scanner app.

Good to know

n/a


3.9 MMS

Classname/Classfile: MMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a MMS (message). You can choose if you want to prepare the message or just let the QR code open the messaging app with the correct phonenumber.

How to use it - simple way

MMSgenerator=newMMS("+491701234567","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new MMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingMMSEncodingMMSEncoding.MMSEncoding type

Overload 2
Description: (Pre-)composes a new MMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the MMS
encodingMMSEncodingMMSEncoding.MMSEncoding type

Good to know

This payload type supports (as some of the other payload types, too) different output formats. In most cases/regions you should use the MMSEncoding.MMS-type.


3.10 Monero address/payment

Classname/Classfile: MoneroTransaction / PayloadGenerator.cs

When to use?

This payload opens the user's Monero client/app and prefills its dialog with the given data. Either you pass only the Monero address or you add complete payment/transaction details.

How to use it - simple way

MoneroTransactiongenerator=newMoneroTransaction("46BeWrHpwXmHDpDEUmZBWZfoQpdc6HaERCNmx1pEYL2rAcuwufPN9rXHHtyUA4QVy66qeFQkn6sfK8aHYjA3jk3o1Bv16em");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a Monero payload.

Parameter nameTypeDefaultDescription
addressstringReceiver's monero address
txAmountfloat?nullAmount to transfer
txPaymentIdstringnullPayment id
recipientNamestringnullReceipient's name
txDescriptionstringnullReference text / payment description

Good to know

n/a


3.11 One-Time-Password

Classname/Classfile: OneTimePassword / PayloadGenerator.cs

When to use?

This payload generates a one-time-password QR code which is used for credential-exchange and authentification. You may use it in combination with the Google Authenticator.

How to use it - simple way

OneTimePasswordgenerator=newOneTimePassword(){Secret="pwq6 5q55",Issuer="Google",Label="test@google.com",};stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 0 special overloads. As can be seen in the example above these generator takes it values via properties.

Property nameTypeDefaultDescription
TypeOneTimePassword AuthTypeOneTimePasswordAuth Type.TOTPType of the one-time-password. Either TOTP or HOTP
AlgorithmOoneTimePassword AuthAlgorithmOoneTimePasswordAuth Algorithm.SHA1Algorith of the one-time-password. Either SHA1, SHA256 or SHA512
IssuerstringThe issuer's name
SecretstringThe Base32 encoded secret key
LabelstringThe label
Digitsint6Number of digits
Counterint?nullShall a counter be used?
Periodint?30Valid period

Good to know

The payload generator builds the correct payload for you, but it can't/doesn't calculate the TOTP/HOTP secret for you.


3.12 Phonenumber

Classname/Classfile: PhoneNumber / PayloadGenerator.cs

When to use?

Use it, when you wan't to share a phonenumber or when you want to use the QR code as CTA (call-to-action). Once scanned, the code opens the dialer app on the phone.

How to use it - simple way

PhoneNumbergenerator=newPhoneNumber("+491701234567");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a phone call payload.

Parameter nameTypeDefaultDescription
numberstringPhonenumber of the receiver

Good to know

There is no right or wrong formatting of the given phonenumber. Type the number in this way, you would type it into your phone's dialer.


3.13 RussiaPaymentOrder

Classname/Classfile: RussiaPaymentOrder / PayloadGenerator.cs

When to use?

Use it to generate QR codes for payments in Russia that are compliant to the standard ГОСТ Р 56042-2014.

How to use it - simple way

varaccount="40702810138250123017";varbic="044525225";varbankName="ОАО \"БАНК\"";varname="ООО «Три кита»";varcorrespAcc="30101810965770000413";vargenerator=newPayloadGenerator.RussiaPaymentOrder(name,account,bankName,bic,correspAcc);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(3);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a RussiaPaymentOrder configuration QR code payload.

Parameter nameTypeDefaultDescription
namestringName of the payee (Наименование получателя платежа)
personalAccstringBeneficiary account number (Номер счета получателя платежа)
bankNamestringName of the beneficiary's bank (Наименование банка получателя платежа)
BICstringBIC (БИК)
correspAccstringnullBox number / account payee's bank (Номер кор./сч. банка получателя платежа)
optionalFieldsOptionalFieldsnullOptional additional fields/information
characterSetCharacterSetsCharacterSets.utf_8Encoding of the payload string

Good to know

  • If CharacterSets was set to windows-1251 or koi8-r you should use ToBytes() instead of ToString() and pass the byte-array directly to CreateQrCode()!
  • The maximum length of a RussiaPaymentOrder is 300 byte as defined by the offical standard. Thus it isn't possible to use all additional fields at the same time.

3.14 Shadowsocks configuration

Classname/Classfile: ShadowSocksConfig / PayloadGenerator.cs

When to use?

Use it to share ShadowSocks (Proxy) configurations. When scanned, the QR scanner app should start the ShadowSocks with the given configuration.

How to use it - simple way

ShadowSocksConfiggenerator=newShadowSocksConfig("45.78.47.87",443,"laozhang",ShadowSocksConfig.Method.Aes256Cb);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a ShadowSocks configuration QR code payload.

Parameter nameTypeDefaultDescription
hostnamestringHostname of the ShadowSocks proxy
portintPort of the ShadowSocks proxy
passwordstringPassword of the SS proxy
methodMethodEncryption type
tagstringnullOptional tag line

Good to know

The value of port must be in the range within 1 and 65535. The tag parameter is optional.


3.15 Skype call

Classname/Classfile: SkypeCall / PayloadGenerator.cs

When to use?

Use it when you want to initiate Skype calls. When scanned, the QR scanner app opens skype and calls the user given to the payload generator.

How to use it - simple way

SkypeCallgenerator=newSkypeCall("johndoe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a skype call action payload.

Parameter nameTypeDefaultDescription
skypeUsernamestringSkype username which will be called

Good to know

n/a


3.16 SlovenianUpnQr

Classname/Classfile: SlovenianUpnQr / PayloadGenerator.cs

When to use?

Used for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order)

How to use it - simple way

varpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,recipientSiModel,recipientSiReference,code);//or if you need requested date of debitor’s payment (payment deadline) includedvarpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,deadline,recipientSiModel,recipientSiReference,code);QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);BitmapqrCodeImage=qrCode.GetGraphic(5);qrCodeImage.Save(@"GeneratedQRCode.bmp");

Parameter table

Parameter nameTypeMax LengthDefaultDescription
payerNamestring33Debitor (payer) name
payerAddressstring33Debitor (payer) address (Street name and house number)
payerPlacestring33Debitor (payer) place (Postal code and name)
recipientNamestring33Creditor (payee) name
recipientAddressstring33Creditor (payee) address (Street name and house number)
recipientPlacestring33Creditor (payee) place (Postal code and name)
recipientIbanstring34Creditor's IBAN
descriptionstring42Description/Comment
amountdoubleAmount (in EUR)
deadlineDateTime?Requested date of debitor's payment
recipientSiModelstring4SI99SI model
recipientSiReferencestring22SI reference
codestring4OTHRPurpose of Payment Code

Good to know

Important: As per official specification Slovenian UPN QR codes have to be generated with ECC-Level M (15%), ECI Mode set to ISO8859-2, Byte mode and QR Version of 15. If you pass the Payload-class itself to the QRCoder (as shown in the last example) then you don't have to set this parameters, since the Payload-class does this automatically.


3.17 SMS

Classname/Classfile: SMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a SMS (message). You can choose if you want to create the message including text or just let the QR code open the messaging app with the given phonenumber.

How to use it - simple way

SMSgenerator=newSMS("+491701234567","Hi John, do you remember SMS?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new SMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingSMSEncodingSMSEncoding.SMSEncoding type

Overload 2
Description: (Pre-)composes a new SMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the SMS
encodingSMSEncodingSMSEncoding.SMSEncoding type

Good to know

This payload supports different output formats. In most cases/regions you should use the SMSEncoding.SMS-type, which should work with the most scanner apps.


3.18 SwissQrCode (ISO-20022)

Classname/Classfile: SwissQRCode / PayloadGenerator.cs

When to use?

Opens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein). Note: Take care of the advices from the "Good to know" section.

How to use it - simple way

SwissQrCode.ContactcontactGeneral=SwissQrCode.Contact.WithStructuredAddress("John Doe","3003","Bern","CH","Parlamentsgebäude","1");SwissQrCode.Ibaniban=newSwissQrCode.Iban("CH2609000000857666015",PayloadGenerator.SwissQrCode.Iban.IbanType.QrIban);SwissQrCode.Referencereference=newSwissQrCode.Reference(SwissQrCode.Reference.ReferenceType.QRR,"990005000000000320071012303",SwissQrCode.Reference.ReferenceTextType.QrReference);SwissQrCode.AdditionalInformationadditionalInformation=newSwissQrCode.AdditionalInformation("This is my unstructured message.","Some bill information here...");SwissQrCode.Currencycurrency=SwissQrCode.Currency.CHF;decimalamount=100.25m;SwissQrCodepayload=newSwissQrCode(iban,currency,contactGeneral,additionalInformation,reference,null,amount,null,null);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20,Color.Black,Color.White,(Bitmap)Bitmap.FromFile(Application.StartupPath+"\\CH-Kreuz_7mm.png"),14,1);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a new Swiss Qr code.

Parameter nameTypeDefaultDescription
ibanIbanIBAN object
currencyCurrencyCurrency (either EUR or CHF)
creditorContactCreditor (payee) information
referenceReferenceReference information
additionalInformationAdditionalInformationnullAdditional information texts
debitorContactnullDebitor (payer) information
amountdecimal?nullAmount
requestedDateOfPaymentDateTime?nullObsoleteRequested date of debitor's payment
ultimateCreditorContactnullUltimate creditor information (use only in consultation with your bank!)
alternativeProcedure1stringnullOptional command for alternative processing mode - line 1
alternativeProcedure2stringnullOptional command for alternative processing mode - line 2

Good to know

  • Important: As per official specification Swiss QR codes have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().
  • Important: As per official specification a Swiss cross logo (can be downloaded here) has to be drawn on the code with a size of ~14%. (Per spec the Swiss cross has to be 7mm per side and the Swiss Qr code should be printed with 46mm without quiet zones or 49,2mm per side with quietzones. So we get 7/(49,2/100) = 14% icon size.)

3.19 URL

Classname/Classfile: Url / PayloadGenerator.cs

When to use?

Use it to share links/websites.

How to use it - simple way

Urlgenerator=newUrl("https://github.com/codebude/QRCoder/");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a link payload.

Parameter nameTypeDefaultDescription
urlstringLink url target

Good to know

If you a domain (without http:// or https://) is given, the payload generater prefixes the given url with http://.


3.20 WhatsAppMessage

Classname/Classfile: WhatsAppMessage / PayloadGenerator.cs

When to use?

Use it to share your WhatApp pre-composed WhatsAppMessages. Once scanned, the QR code opens a WhatsApp chat with the given message.

How to use it - simple way

WhatsAppMessagegenerator=newWhatsAppMessage("Hi John, what do you think about QR codes?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new WhatsApp message.

Parameter nameTypeDefaultDescription
messagestringThe message text

Overload 2
Description: Generates a new WhatsApp message towards a given contact.

Parameter nameTypeDefaultDescription
numberstringRecipient/contact number
messagestringThe message text

Good to know

-/-


3.21 WiFi

Classname/Classfile: WiFi / PayloadGenerator.cs

When to use?

Use it when you want to share WiFi credentials. Good for meetings, house partys and conventions.

How to use it - simple way

WiFigenerator=newWiFi("My-WiFis-Name","s3cr3t-p4ssw0rd",WiFi.Authentication.WPA);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates WiFi login credentials.

Parameter nameTypeDefaultDescription
ssidstringSSID of the WiFi network
passwordstringPassword of the WiFi network
authenticationModeAuthenticationAuthentification mode (WEP, WPA, WPA2)
isHiddenSSIDboolfalseSet flag to true, if the WiFi network hides its SSID
escapeHexStringsbooltrueSet flag to false, if SSID/password shouldn't be escaped, even if passed as HEX string

Good to know

  • Don't get confused when choosing authenticationMode-parameter. The value WiFi.Authentication.WPA also includes not only WPA but also WPA2!
  • For widest compatibility you may set escapeHexStrings to false, because if SSID/password are provided in HEX style ([A-F0-9] and will be escaped, the QR code may become unreadable by Apple devices. More info: )

4. Development of own payload types

Implementing your own, custom payload generator is quite easy. Simply create a new class for your custom payload and implement the QRCoder.PayloadGenerator.Payload-interface. The only method you have to implement/override is the ToString()-method.

publicclassHelloWorldPayload:Payload{privatestring_name;publicHelloWorldPayload(stringname){_name=name;}publicoverridestringToString(){return$"Hello {_name}";}}

If you have written a cool generator, feel free to send it in as PullRequest.

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Advanced usage Payload generators

Raffael Herrmann edited this page May 22, 2024 · 32 revisions
  1. Introduction to the "Payload Generator"
  2. Overview of the different payload types
  3. Usage of the payload generators
    3.1 BezahlCode
    3.2 Crypto Payment Address (e.g. Bitcoin, Litecoin, ...)
    3.3 Bookmark
    3.4 Calendar events (iCal/vEvent)
    3.5 ContactData (MeCard/vCard)
    3.6 Geolocation
    3.7 Girocode
    3.8 Mail
    3.9 MMS
    3.10 Monero address/payment
    3.11 One-Time-Password
    3.12 Phonenumber
    3.13 Russia Payment Order
    3.14 Shadowsocks configuration
    3.15 Skype call
    3.16 Slovenian QR Code for UPN QR Forms
    3.17 SMS
    3.18 SwissQrCode (ISO-20022)
    3.19 URL
    3.20 WhatsAppMessage
    3.21 WiFi
  4. Development of own payload types

1. Introduction to the "Payload Generator"

The payload generator is one of the things, which make the QRCoder unique. It's a class which helps to generate special payloads (=the text encoded in QR codes) that will start different actions on the device which scans the QR code.

Indeed a QR code can only encode a string (of text), but if this string has a special format, most* QR code scanners will perform a predefined action.

To help you to create these special formatted payload strings, we implemented the payload generators. These are easy-to-use classes, which check your data for invalid inputs and "automagically" create the fitting payload strings for you.

Info:Keep in mind, that all payload types stand and fall with the commitment between QR encoders and QR scanner apps. Special payload types aren't defined in the QR code standard (ISO/IEC 18004). Most of the QR code scanner apps are able to interpret the payload types described on this page. But in a real world application you should test your QR codes against the scanners your users will use.


2. Overview of the different payload types

Right now there are 19 different payload generators. To get a quick overview, have a look at the following table.

(Class-)NameWhat does it do, when scanned?Specification
BezahlCodeOpens the banking app for bank transfers, debits and banker's order. It's common in German-speaking countries and competes with the more common GiroCode.Bezahlcode specification
Bitcoin(LikeCryptoCurrency)AddressStarts crypto currency app for transfers.BIP 0021
BookmarkSaves a bookmark to the default webbrowser.NTTdocomo MEBKM
CalendarEventAdds an event to the user's calendar. Supports iCal and vEvent format.RFC 5545
ContactDataAdds a contact to the user's address book. Supports MeCard, vCard 2.1, vCard 3.0 and vCard 4.0 format.NTTdocomo MeCard, RFC 2425 (vCard 2.1), RFC 2426 (vCard 3.0), RFC 6350 (vCard 4.0)
GeolocationOpens the maps app and shows the given location or opens Google Maps in browser.RFC 5870
GirocodeOpens the banking app for bank transfers. It's common in the European region and competes with the less common BezahlCode.EPC069-12
MailOpens the default email app and composes a new message. Supports mailto:, MATMSG: and smtp: format.RFCRFC 6068, NTTdocomo MATMSG, smtp URI scheme
MMSOpens the standard messaging app and composes a new MMS. Either in mmsto: or in mms: format.RFC draft (mmsto), Data Services: Whitepaper (mms)
MoneroTransactionOpens the Monero wallet with transaction details.Monero URI scheme
OneTimePasswordEncoded secret keys. May be used in combination with Google Authenticator for example.Key URI Format
PhoneNumberOpens the phone's dialer app with given number.RFC 3966
ShadowSocksConfigOpens ShadowSocks app with given configuration.ShadowSocks URI scheme
SkypeCallOpens Skype app and calls given contact.Skype URI API reference
SlovenianUpnQrUsed for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order).Technical description, Advice for programmers
SMSOpen SMS app and composes new message. Supports sms:, sms: (for iOS) and SMSTO: format.RFC 5724 (sms), sms URI for iOS, SMSTO (not common)
SwissQrCodeOpens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein).ISO 20022
UrlOpens the given URL in default webbrowser.RFC 3986
WhatsAppMessageOpen whatsapp, lets you choose a contact and composes a new message with given text.WhatsApp URL Scheme
WiFiWhen scanned, the scanning device can login to the given WiFi without typing the credentials.Short description

3. Usage of the payload generators

3.1 BezahlCode

Classname/Classfile: BezahlCode / PayloadGenerator.cs

When to use?

Use it for banking (inlcuding bank transfers, debits, bank contacts and banker's order). It's used in German-speaking countries and competes with the more common GiroCode.

How to use it - simple way

The following code generates a payload for a simple SEPA payment to Wikimedia.

BezahlCodegenerator=newBezahlCode(BezahlCode.AuthorityType.singlepaymentsepa,"Wikimedia",iban:"DE33100205000001194700",bic:"BFSWDE33BER",amount:25.00m);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are four overloads:

Overload 1
Description: Creates a payload for SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 2
Description: Creates a payload for non SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 3
Description: Creates a payload for exchange of bank/payment contact data

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstring""Bank account (Kontonummer)
bncstring""Bank institute (Bankleitzahl)
ibanstring""IBAN
bicstring""BIC
reasonstring""Reason (Verwendungszweck)

Overload 4
Description: Generic constructor used by overload 1 and 2.

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)
internalModeint0Only used for internal state handdling

Good to know

BezahlCode is a format which competes with the GiroCode. Both can be used for banking purposes but GiroCode is a little more common and newer. Nevertheless BezahlCode has some more features like periodic transfer and debits. So before choose one of both, check which one fits your needs and which one is better supported by your users and their QR code scanner apps.


3.2 (Bitcoin like) Crypto Currency Payment Address

Classname/Classfile: BitcoinAddress|BitcoinCashAddress|LitecoinAddress / PayloadGenerator.cs

When to use?

Use this payload to share Bitcoin/Bitcoin Cash/Litecoin addresses or initiate payments in one of those currencies.

How to use it - simple way

BitcoinAddressgenerator=newPayloadGenerator.BitcoinAddress("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W",1.5d);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a Bitcoin address with or without amount to transfer and message.

Parameter nameTypeDefaultDescription
addressstringBitcoin address of the payment receiver
amountdouble?Amount of Bitcoins to transfer
labelstringnullReference label
messagestringnullReferece text aka message

Good to know

If you want to share only the crypto currency address without any amount of coins, set the variable amount to null. Replace "Bitcoin" by "BitcoinCash" or "Litecoin" to generate payloads for those currencies.


3.3 Bookmark

Classname/Classfile: Bookmark / PayloadGenerator.cs

When to use?

Use this payload, when you want to place a bookmark in the user's default webbrowser.

How to use it - simple way

Bookmarkgenerator=newBookmark("http://code-bude.net","Blog of QRCoder's father");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a bookmark payload including the bookmark title.

Parameter nameTypeDefaultDescription
urlstringUrl of the bookmark
titlestringTitle of the bookmark

Good to know

n/a


3.4 Calendar events (iCal/vEvent)

Classname/Classfile: CalendarEvent / PayloadGenerator.cs

When to use?

Use this payload to place an event to the user's calendar application.

How to use it - simple way

CalendarEventgenerator=newCalendarEvent("Birthday party","Join QRCoder's fourth birthday!","51.26118,6.6717",newDateTime(2017,10,13),newDateTime(2017,10,13),true);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeStart time of the event
endDateTimeEnd time of the event
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Overload 2
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeOffsetStart time of the event incl. offset in relation to UTC
endDateTimeOffsetEnd time of the event incl. offset in relation to UTC
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Good to know

The parameters description and location are optional. They can be set to null or string.Empty. If you want to place an event to Apple users you should use iCal instead of Universal as encoding.


3.5 ContactData (MeCard/vCard)

Classname/Classfile: ContactData / PayloadGenerator.cs

When to use?

Use it, when you want to share contact data/business cards. A QR code with this payload type will add the contact data to the user's address book.

How to use it - simple way

ContactDatagenerator=newContactData(ContactData.ContactOutputType.VCard3,"John","Doe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates contact data payload in different formats.

Parameter nameTypeDefaultDescription
outputTypeContactOutputTypePayload output type
firstnamestringThe firstname
lastnamestringThe lastname
nicknamestringnullThe displayname
phonestringnullNormal phone number
mobilePhonestringnullMobile phone
workPhonestringnullOffice phone number
emailstringnullE-Mail address
birthdayDateTime?nullBirthday
websitestringnullWebsite / Homepage
streetstringnullStreet
houseNumberstringnullHousenumber
citystringnullCity
zipCodestringnullZip code
countrystringnullCountry
notestringnullMemo text / notes
stateRegionstringnullState / Region
addressOrderAddressOrderAddressOrder.Defaultenum to define address order (see below)
orgstringnullOrganization/Company
orgTitlestringnullOrganization/Company title

Good to know

Via the parameter outputType you can choose between different formats. Supported formats are: vCard 2.1, vCard 3.0, vCard 4.0 and MeCard. Choose the format which fits your needs. Right now vCard 3.0 is the most used format.

The addressOrderenum specifies in which format the address is rendered. The two options are:

  • Default
    The address format used in European countries and others.
    Sample

    John Doe
    Königsallee 1
    40210 Düsseldorf
    Germany

  • Reversed
    The address format used in North America and others.
    Sample

    John Doe
    123 Fake St.
    Cleveland, OH, 12345
    USA


3.6 Geolocation

Classname/Classfile: Geolocation / PayloadGenerator.cs

When to use?

Use this payload type when you want to share a location. You can choose between the geo-format and Google Maps links.

How to use it - simple way

Geolocationgenerator=newGeolocation("51.26118","6.6717");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: The payload encodes a (geo-)location by its coordinates.

Parameter nameTypeDefaultDescription
latitudestringLatitude with . as splitter
longitudestringLongitude with . as splitter
encodingGeolocationEncodingGeolocationEncoding.GEOEncoding type - GEO or GoogleMaps

Good to know

If you use the geo-format the QR scanner app must support this tag. Most scanners do so. But if you want to be 100% on the safe side, choose Google Maps format because this generates a Google Maps (web-)link which can be interpreted by nearly any QR code scanner.


3.7 Girocode

Classname/Classfile: Girocode / PayloadGenerator.cs

When to use?

Use this payload type if you want to share payment contact information and/or bank transfer data. The Girocode is an European standard and supports SEPA payments.

How to use it - simple way

varpayload=newGirocode("DE33100205000001194700","BFSWDE33BER","Wikimedia",1337.99m);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates the Girocode payload with different options.

Parameter nameTypeDefaultDescription
ibanstringAccount number of the Beneficiary. Only IBAN is allowed.
bicstringBIC of the Beneficiary Bank.
namestringName of the Beneficiary.
amountdecimalAmount of the Credit Transfer in Euro. (Amount must be more than 0.01 and less than 999999999.99)
remittanceInformationstring""Remittance Information (Purpose-/reference text). (optional)
typeOfRemittanceTypeOfRemittanceTypeOfRemittance. UnstructuredType of remittance information. Either structured (e.g. ISO 11649 RF Creditor Reference) and max. 35 chars or unstructured and max. 140 chars.
purposeOfCreditTransferstring""Purpose of the Credit Transfer (optional)
messageToGirocodeUserstring""Beneficiary to originator information. (optional)
versionGirocodeVersionGirocodeVersion. Version1Girocode version. Either 001 or 002. Default: 001.
encodingGirocodeEncodingGirocodeEncoding. ISO_8859_1Encoding of the Girocode payload. Default: ISO-8859-1

Good to know

Important: As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().

Girocode competes (atleast for German-speaking countries) with the Bezahlcode. Even if Girocode has less features, it is more common than Bezahlcode. So choose the right payload type in respect of your users and the features you want to use.


3.8 Mail

Classname/Classfile: Mail / PayloadGenerator.cs

When to use?

Use it when you want to prepare/compose an email. Once scanned the code opens the default mail client with the given information like receiver, subject and message.

How to use it - simple way

Mailgenerator=newMail("john@doe.com","Look at this!","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is one overload:

Overload 1
Description: Creates a new mail with optional subject and body/message.

Parameter nameTypeDefaultDescription
mailReceiverstringnullReceiver's email address
subjectstringnullSubject line of the email
messagestringnullMessage content of the email
encodingMailEncodingMailEncoding.MAILTOPayload encoding type. Choose dependent on your QR Code scanner app.

Good to know

n/a


3.9 MMS

Classname/Classfile: MMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a MMS (message). You can choose if you want to prepare the message or just let the QR code open the messaging app with the correct phonenumber.

How to use it - simple way

MMSgenerator=newMMS("+491701234567","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new MMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingMMSEncodingMMSEncoding.MMSEncoding type

Overload 2
Description: (Pre-)composes a new MMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the MMS
encodingMMSEncodingMMSEncoding.MMSEncoding type

Good to know

This payload type supports (as some of the other payload types, too) different output formats. In most cases/regions you should use the MMSEncoding.MMS-type.


3.10 Monero address/payment

Classname/Classfile: MoneroTransaction / PayloadGenerator.cs

When to use?

This payload opens the user's Monero client/app and prefills its dialog with the given data. Either you pass only the Monero address or you add complete payment/transaction details.

How to use it - simple way

MoneroTransactiongenerator=newMoneroTransaction("46BeWrHpwXmHDpDEUmZBWZfoQpdc6HaERCNmx1pEYL2rAcuwufPN9rXHHtyUA4QVy66qeFQkn6sfK8aHYjA3jk3o1Bv16em");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a Monero payload.

Parameter nameTypeDefaultDescription
addressstringReceiver's monero address
txAmountfloat?nullAmount to transfer
txPaymentIdstringnullPayment id
recipientNamestringnullReceipient's name
txDescriptionstringnullReference text / payment description

Good to know

n/a


3.11 One-Time-Password

Classname/Classfile: OneTimePassword / PayloadGenerator.cs

When to use?

This payload generates a one-time-password QR code which is used for credential-exchange and authentification. You may use it in combination with the Google Authenticator.

How to use it - simple way

OneTimePasswordgenerator=newOneTimePassword(){Secret="pwq6 5q55",Issuer="Google",Label="test@google.com",};stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 0 special overloads. As can be seen in the example above these generator takes it values via properties.

Property nameTypeDefaultDescription
TypeOneTimePassword AuthTypeOneTimePasswordAuth Type.TOTPType of the one-time-password. Either TOTP or HOTP
AlgorithmOoneTimePassword AuthAlgorithmOoneTimePasswordAuth Algorithm.SHA1Algorith of the one-time-password. Either SHA1, SHA256 or SHA512
IssuerstringThe issuer's name
SecretstringThe Base32 encoded secret key
LabelstringThe label
Digitsint6Number of digits
Counterint?nullShall a counter be used?
Periodint?30Valid period

Good to know

The payload generator builds the correct payload for you, but it can't/doesn't calculate the TOTP/HOTP secret for you.


3.12 Phonenumber

Classname/Classfile: PhoneNumber / PayloadGenerator.cs

When to use?

Use it, when you wan't to share a phonenumber or when you want to use the QR code as CTA (call-to-action). Once scanned, the code opens the dialer app on the phone.

How to use it - simple way

PhoneNumbergenerator=newPhoneNumber("+491701234567");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a phone call payload.

Parameter nameTypeDefaultDescription
numberstringPhonenumber of the receiver

Good to know

There is no right or wrong formatting of the given phonenumber. Type the number in this way, you would type it into your phone's dialer.


3.13 RussiaPaymentOrder

Classname/Classfile: RussiaPaymentOrder / PayloadGenerator.cs

When to use?

Use it to generate QR codes for payments in Russia that are compliant to the standard ГОСТ Р 56042-2014.

How to use it - simple way

varaccount="40702810138250123017";varbic="044525225";varbankName="ОАО \"БАНК\"";varname="ООО «Три кита»";varcorrespAcc="30101810965770000413";vargenerator=newPayloadGenerator.RussiaPaymentOrder(name,account,bankName,bic,correspAcc);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(3);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a RussiaPaymentOrder configuration QR code payload.

Parameter nameTypeDefaultDescription
namestringName of the payee (Наименование получателя платежа)
personalAccstringBeneficiary account number (Номер счета получателя платежа)
bankNamestringName of the beneficiary's bank (Наименование банка получателя платежа)
BICstringBIC (БИК)
correspAccstringnullBox number / account payee's bank (Номер кор./сч. банка получателя платежа)
optionalFieldsOptionalFieldsnullOptional additional fields/information
characterSetCharacterSetsCharacterSets.utf_8Encoding of the payload string

Good to know

  • If CharacterSets was set to windows-1251 or koi8-r you should use ToBytes() instead of ToString() and pass the byte-array directly to CreateQrCode()!
  • The maximum length of a RussiaPaymentOrder is 300 byte as defined by the offical standard. Thus it isn't possible to use all additional fields at the same time.

3.14 Shadowsocks configuration

Classname/Classfile: ShadowSocksConfig / PayloadGenerator.cs

When to use?

Use it to share ShadowSocks (Proxy) configurations. When scanned, the QR scanner app should start the ShadowSocks with the given configuration.

How to use it - simple way

ShadowSocksConfiggenerator=newShadowSocksConfig("45.78.47.87",443,"laozhang",ShadowSocksConfig.Method.Aes256Cb);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a ShadowSocks configuration QR code payload.

Parameter nameTypeDefaultDescription
hostnamestringHostname of the ShadowSocks proxy
portintPort of the ShadowSocks proxy
passwordstringPassword of the SS proxy
methodMethodEncryption type
tagstringnullOptional tag line

Good to know

The value of port must be in the range within 1 and 65535. The tag parameter is optional.


3.15 Skype call

Classname/Classfile: SkypeCall / PayloadGenerator.cs

When to use?

Use it when you want to initiate Skype calls. When scanned, the QR scanner app opens skype and calls the user given to the payload generator.

How to use it - simple way

SkypeCallgenerator=newSkypeCall("johndoe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a skype call action payload.

Parameter nameTypeDefaultDescription
skypeUsernamestringSkype username which will be called

Good to know

n/a


3.16 SlovenianUpnQr

Classname/Classfile: SlovenianUpnQr / PayloadGenerator.cs

When to use?

Used for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order)

How to use it - simple way

varpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,recipientSiModel,recipientSiReference,code);//or if you need requested date of debitor’s payment (payment deadline) includedvarpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,deadline,recipientSiModel,recipientSiReference,code);QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);BitmapqrCodeImage=qrCode.GetGraphic(5);qrCodeImage.Save(@"GeneratedQRCode.bmp");

Parameter table

Parameter nameTypeMax LengthDefaultDescription
payerNamestring33Debitor (payer) name
payerAddressstring33Debitor (payer) address (Street name and house number)
payerPlacestring33Debitor (payer) place (Postal code and name)
recipientNamestring33Creditor (payee) name
recipientAddressstring33Creditor (payee) address (Street name and house number)
recipientPlacestring33Creditor (payee) place (Postal code and name)
recipientIbanstring34Creditor's IBAN
descriptionstring42Description/Comment
amountdoubleAmount (in EUR)
deadlineDateTime?Requested date of debitor's payment
recipientSiModelstring4SI99SI model
recipientSiReferencestring22SI reference
codestring4OTHRPurpose of Payment Code

Good to know

Important: As per official specification Slovenian UPN QR codes have to be generated with ECC-Level M (15%), ECI Mode set to ISO8859-2, Byte mode and QR Version of 15. If you pass the Payload-class itself to the QRCoder (as shown in the last example) then you don't have to set this parameters, since the Payload-class does this automatically.


3.17 SMS

Classname/Classfile: SMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a SMS (message). You can choose if you want to create the message including text or just let the QR code open the messaging app with the given phonenumber.

How to use it - simple way

SMSgenerator=newSMS("+491701234567","Hi John, do you remember SMS?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new SMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingSMSEncodingSMSEncoding.SMSEncoding type

Overload 2
Description: (Pre-)composes a new SMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the SMS
encodingSMSEncodingSMSEncoding.SMSEncoding type

Good to know

This payload supports different output formats. In most cases/regions you should use the SMSEncoding.SMS-type, which should work with the most scanner apps.


3.18 SwissQrCode (ISO-20022)

Classname/Classfile: SwissQRCode / PayloadGenerator.cs

When to use?

Opens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein). Note: Take care of the advices from the "Good to know" section.

How to use it - simple way

SwissQrCode.ContactcontactGeneral=SwissQrCode.Contact.WithStructuredAddress("John Doe","3003","Bern","CH","Parlamentsgebäude","1");SwissQrCode.Ibaniban=newSwissQrCode.Iban("CH2609000000857666015",PayloadGenerator.SwissQrCode.Iban.IbanType.QrIban);SwissQrCode.Referencereference=newSwissQrCode.Reference(SwissQrCode.Reference.ReferenceType.QRR,"990005000000000320071012303",SwissQrCode.Reference.ReferenceTextType.QrReference);SwissQrCode.AdditionalInformationadditionalInformation=newSwissQrCode.AdditionalInformation("This is my unstructured message.","Some bill information here...");SwissQrCode.Currencycurrency=SwissQrCode.Currency.CHF;decimalamount=100.25m;SwissQrCodepayload=newSwissQrCode(iban,currency,contactGeneral,additionalInformation,reference,null,amount,null,null);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20,Color.Black,Color.White,(Bitmap)Bitmap.FromFile(Application.StartupPath+"\\CH-Kreuz_7mm.png"),14,1);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a new Swiss Qr code.

Parameter nameTypeDefaultDescription
ibanIbanIBAN object
currencyCurrencyCurrency (either EUR or CHF)
creditorContactCreditor (payee) information
referenceReferenceReference information
additionalInformationAdditionalInformationnullAdditional information texts
debitorContactnullDebitor (payer) information
amountdecimal?nullAmount
requestedDateOfPaymentDateTime?nullObsoleteRequested date of debitor's payment
ultimateCreditorContactnullUltimate creditor information (use only in consultation with your bank!)
alternativeProcedure1stringnullOptional command for alternative processing mode - line 1
alternativeProcedure2stringnullOptional command for alternative processing mode - line 2

Good to know

  • Important: As per official specification Swiss QR codes have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().
  • Important: As per official specification a Swiss cross logo (can be downloaded here) has to be drawn on the code with a size of ~14%. (Per spec the Swiss cross has to be 7mm per side and the Swiss Qr code should be printed with 46mm without quiet zones or 49,2mm per side with quietzones. So we get 7/(49,2/100) = 14% icon size.)

3.19 URL

Classname/Classfile: Url / PayloadGenerator.cs

When to use?

Use it to share links/websites.

How to use it - simple way

Urlgenerator=newUrl("https://github.com/codebude/QRCoder/");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a link payload.

Parameter nameTypeDefaultDescription
urlstringLink url target

Good to know

If you a domain (without http:// or https://) is given, the payload generater prefixes the given url with http://.


3.20 WhatsAppMessage

Classname/Classfile: WhatsAppMessage / PayloadGenerator.cs

When to use?

Use it to share your WhatApp pre-composed WhatsAppMessages. Once scanned, the QR code opens a WhatsApp chat with the given message.

How to use it - simple way

WhatsAppMessagegenerator=newWhatsAppMessage("Hi John, what do you think about QR codes?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new WhatsApp message.

Parameter nameTypeDefaultDescription
messagestringThe message text

Overload 2
Description: Generates a new WhatsApp message towards a given contact.

Parameter nameTypeDefaultDescription
numberstringRecipient/contact number
messagestringThe message text

Good to know

-/-


3.21 WiFi

Classname/Classfile: WiFi / PayloadGenerator.cs

When to use?

Use it when you want to share WiFi credentials. Good for meetings, house partys and conventions.

How to use it - simple way

WiFigenerator=newWiFi("My-WiFis-Name","s3cr3t-p4ssw0rd",WiFi.Authentication.WPA);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates WiFi login credentials.

Parameter nameTypeDefaultDescription
ssidstringSSID of the WiFi network
passwordstringPassword of the WiFi network
authenticationModeAuthenticationAuthentification mode (WEP, WPA, WPA2)
isHiddenSSIDboolfalseSet flag to true, if the WiFi network hides its SSID
escapeHexStringsbooltrueSet flag to false, if SSID/password shouldn't be escaped, even if passed as HEX string

Good to know

  • Don't get confused when choosing authenticationMode-parameter. The value WiFi.Authentication.WPA also includes not only WPA but also WPA2!
  • For widest compatibility you may set escapeHexStrings to false, because if SSID/password are provided in HEX style ([A-F0-9] and will be escaped, the QR code may become unreadable by Apple devices. More info: )

4. Development of own payload types

Implementing your own, custom payload generator is quite easy. Simply create a new class for your custom payload and implement the QRCoder.PayloadGenerator.Payload-interface. The only method you have to implement/override is the ToString()-method.

publicclassHelloWorldPayload:Payload{privatestring_name;publicHelloWorldPayload(stringname){_name=name;}publicoverridestringToString(){return$"Hello {_name}";}}

If you have written a cool generator, feel free to send it in as PullRequest.

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Advanced usage Payload generators

Raffael Herrmann edited this page May 22, 2024 · 32 revisions
  1. Introduction to the "Payload Generator"
  2. Overview of the different payload types
  3. Usage of the payload generators
    3.1 BezahlCode
    3.2 Crypto Payment Address (e.g. Bitcoin, Litecoin, ...)
    3.3 Bookmark
    3.4 Calendar events (iCal/vEvent)
    3.5 ContactData (MeCard/vCard)
    3.6 Geolocation
    3.7 Girocode
    3.8 Mail
    3.9 MMS
    3.10 Monero address/payment
    3.11 One-Time-Password
    3.12 Phonenumber
    3.13 Russia Payment Order
    3.14 Shadowsocks configuration
    3.15 Skype call
    3.16 Slovenian QR Code for UPN QR Forms
    3.17 SMS
    3.18 SwissQrCode (ISO-20022)
    3.19 URL
    3.20 WhatsAppMessage
    3.21 WiFi
  4. Development of own payload types

1. Introduction to the "Payload Generator"

The payload generator is one of the things, which make the QRCoder unique. It's a class which helps to generate special payloads (=the text encoded in QR codes) that will start different actions on the device which scans the QR code.

Indeed a QR code can only encode a string (of text), but if this string has a special format, most* QR code scanners will perform a predefined action.

To help you to create these special formatted payload strings, we implemented the payload generators. These are easy-to-use classes, which check your data for invalid inputs and "automagically" create the fitting payload strings for you.

Info:Keep in mind, that all payload types stand and fall with the commitment between QR encoders and QR scanner apps. Special payload types aren't defined in the QR code standard (ISO/IEC 18004). Most of the QR code scanner apps are able to interpret the payload types described on this page. But in a real world application you should test your QR codes against the scanners your users will use.


2. Overview of the different payload types

Right now there are 19 different payload generators. To get a quick overview, have a look at the following table.

(Class-)NameWhat does it do, when scanned?Specification
BezahlCodeOpens the banking app for bank transfers, debits and banker's order. It's common in German-speaking countries and competes with the more common GiroCode.Bezahlcode specification
Bitcoin(LikeCryptoCurrency)AddressStarts crypto currency app for transfers.BIP 0021
BookmarkSaves a bookmark to the default webbrowser.NTTdocomo MEBKM
CalendarEventAdds an event to the user's calendar. Supports iCal and vEvent format.RFC 5545
ContactDataAdds a contact to the user's address book. Supports MeCard, vCard 2.1, vCard 3.0 and vCard 4.0 format.NTTdocomo MeCard, RFC 2425 (vCard 2.1), RFC 2426 (vCard 3.0), RFC 6350 (vCard 4.0)
GeolocationOpens the maps app and shows the given location or opens Google Maps in browser.RFC 5870
GirocodeOpens the banking app for bank transfers. It's common in the European region and competes with the less common BezahlCode.EPC069-12
MailOpens the default email app and composes a new message. Supports mailto:, MATMSG: and smtp: format.RFCRFC 6068, NTTdocomo MATMSG, smtp URI scheme
MMSOpens the standard messaging app and composes a new MMS. Either in mmsto: or in mms: format.RFC draft (mmsto), Data Services: Whitepaper (mms)
MoneroTransactionOpens the Monero wallet with transaction details.Monero URI scheme
OneTimePasswordEncoded secret keys. May be used in combination with Google Authenticator for example.Key URI Format
PhoneNumberOpens the phone's dialer app with given number.RFC 3966
ShadowSocksConfigOpens ShadowSocks app with given configuration.ShadowSocks URI scheme
SkypeCallOpens Skype app and calls given contact.Skype URI API reference
SlovenianUpnQrUsed for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order).Technical description, Advice for programmers
SMSOpen SMS app and composes new message. Supports sms:, sms: (for iOS) and SMSTO: format.RFC 5724 (sms), sms URI for iOS, SMSTO (not common)
SwissQrCodeOpens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein).ISO 20022
UrlOpens the given URL in default webbrowser.RFC 3986
WhatsAppMessageOpen whatsapp, lets you choose a contact and composes a new message with given text.WhatsApp URL Scheme
WiFiWhen scanned, the scanning device can login to the given WiFi without typing the credentials.Short description

3. Usage of the payload generators

3.1 BezahlCode

Classname/Classfile: BezahlCode / PayloadGenerator.cs

When to use?

Use it for banking (inlcuding bank transfers, debits, bank contacts and banker's order). It's used in German-speaking countries and competes with the more common GiroCode.

How to use it - simple way

The following code generates a payload for a simple SEPA payment to Wikimedia.

BezahlCodegenerator=newBezahlCode(BezahlCode.AuthorityType.singlepaymentsepa,"Wikimedia",iban:"DE33100205000001194700",bic:"BFSWDE33BER",amount:25.00m);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are four overloads:

Overload 1
Description: Creates a payload for SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 2
Description: Creates a payload for non SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 3
Description: Creates a payload for exchange of bank/payment contact data

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstring""Bank account (Kontonummer)
bncstring""Bank institute (Bankleitzahl)
ibanstring""IBAN
bicstring""BIC
reasonstring""Reason (Verwendungszweck)

Overload 4
Description: Generic constructor used by overload 1 and 2.

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)
internalModeint0Only used for internal state handdling

Good to know

BezahlCode is a format which competes with the GiroCode. Both can be used for banking purposes but GiroCode is a little more common and newer. Nevertheless BezahlCode has some more features like periodic transfer and debits. So before choose one of both, check which one fits your needs and which one is better supported by your users and their QR code scanner apps.


3.2 (Bitcoin like) Crypto Currency Payment Address

Classname/Classfile: BitcoinAddress|BitcoinCashAddress|LitecoinAddress / PayloadGenerator.cs

When to use?

Use this payload to share Bitcoin/Bitcoin Cash/Litecoin addresses or initiate payments in one of those currencies.

How to use it - simple way

BitcoinAddressgenerator=newPayloadGenerator.BitcoinAddress("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W",1.5d);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a Bitcoin address with or without amount to transfer and message.

Parameter nameTypeDefaultDescription
addressstringBitcoin address of the payment receiver
amountdouble?Amount of Bitcoins to transfer
labelstringnullReference label
messagestringnullReferece text aka message

Good to know

If you want to share only the crypto currency address without any amount of coins, set the variable amount to null. Replace "Bitcoin" by "BitcoinCash" or "Litecoin" to generate payloads for those currencies.


3.3 Bookmark

Classname/Classfile: Bookmark / PayloadGenerator.cs

When to use?

Use this payload, when you want to place a bookmark in the user's default webbrowser.

How to use it - simple way

Bookmarkgenerator=newBookmark("http://code-bude.net","Blog of QRCoder's father");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a bookmark payload including the bookmark title.

Parameter nameTypeDefaultDescription
urlstringUrl of the bookmark
titlestringTitle of the bookmark

Good to know

n/a


3.4 Calendar events (iCal/vEvent)

Classname/Classfile: CalendarEvent / PayloadGenerator.cs

When to use?

Use this payload to place an event to the user's calendar application.

How to use it - simple way

CalendarEventgenerator=newCalendarEvent("Birthday party","Join QRCoder's fourth birthday!","51.26118,6.6717",newDateTime(2017,10,13),newDateTime(2017,10,13),true);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeStart time of the event
endDateTimeEnd time of the event
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Overload 2
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeOffsetStart time of the event incl. offset in relation to UTC
endDateTimeOffsetEnd time of the event incl. offset in relation to UTC
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Good to know

The parameters description and location are optional. They can be set to null or string.Empty. If you want to place an event to Apple users you should use iCal instead of Universal as encoding.


3.5 ContactData (MeCard/vCard)

Classname/Classfile: ContactData / PayloadGenerator.cs

When to use?

Use it, when you want to share contact data/business cards. A QR code with this payload type will add the contact data to the user's address book.

How to use it - simple way

ContactDatagenerator=newContactData(ContactData.ContactOutputType.VCard3,"John","Doe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates contact data payload in different formats.

Parameter nameTypeDefaultDescription
outputTypeContactOutputTypePayload output type
firstnamestringThe firstname
lastnamestringThe lastname
nicknamestringnullThe displayname
phonestringnullNormal phone number
mobilePhonestringnullMobile phone
workPhonestringnullOffice phone number
emailstringnullE-Mail address
birthdayDateTime?nullBirthday
websitestringnullWebsite / Homepage
streetstringnullStreet
houseNumberstringnullHousenumber
citystringnullCity
zipCodestringnullZip code
countrystringnullCountry
notestringnullMemo text / notes
stateRegionstringnullState / Region
addressOrderAddressOrderAddressOrder.Defaultenum to define address order (see below)
orgstringnullOrganization/Company
orgTitlestringnullOrganization/Company title

Good to know

Via the parameter outputType you can choose between different formats. Supported formats are: vCard 2.1, vCard 3.0, vCard 4.0 and MeCard. Choose the format which fits your needs. Right now vCard 3.0 is the most used format.

The addressOrderenum specifies in which format the address is rendered. The two options are:

  • Default
    The address format used in European countries and others.
    Sample

    John Doe
    Königsallee 1
    40210 Düsseldorf
    Germany

  • Reversed
    The address format used in North America and others.
    Sample

    John Doe
    123 Fake St.
    Cleveland, OH, 12345
    USA


3.6 Geolocation

Classname/Classfile: Geolocation / PayloadGenerator.cs

When to use?

Use this payload type when you want to share a location. You can choose between the geo-format and Google Maps links.

How to use it - simple way

Geolocationgenerator=newGeolocation("51.26118","6.6717");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: The payload encodes a (geo-)location by its coordinates.

Parameter nameTypeDefaultDescription
latitudestringLatitude with . as splitter
longitudestringLongitude with . as splitter
encodingGeolocationEncodingGeolocationEncoding.GEOEncoding type - GEO or GoogleMaps

Good to know

If you use the geo-format the QR scanner app must support this tag. Most scanners do so. But if you want to be 100% on the safe side, choose Google Maps format because this generates a Google Maps (web-)link which can be interpreted by nearly any QR code scanner.


3.7 Girocode

Classname/Classfile: Girocode / PayloadGenerator.cs

When to use?

Use this payload type if you want to share payment contact information and/or bank transfer data. The Girocode is an European standard and supports SEPA payments.

How to use it - simple way

varpayload=newGirocode("DE33100205000001194700","BFSWDE33BER","Wikimedia",1337.99m);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates the Girocode payload with different options.

Parameter nameTypeDefaultDescription
ibanstringAccount number of the Beneficiary. Only IBAN is allowed.
bicstringBIC of the Beneficiary Bank.
namestringName of the Beneficiary.
amountdecimalAmount of the Credit Transfer in Euro. (Amount must be more than 0.01 and less than 999999999.99)
remittanceInformationstring""Remittance Information (Purpose-/reference text). (optional)
typeOfRemittanceTypeOfRemittanceTypeOfRemittance. UnstructuredType of remittance information. Either structured (e.g. ISO 11649 RF Creditor Reference) and max. 35 chars or unstructured and max. 140 chars.
purposeOfCreditTransferstring""Purpose of the Credit Transfer (optional)
messageToGirocodeUserstring""Beneficiary to originator information. (optional)
versionGirocodeVersionGirocodeVersion. Version1Girocode version. Either 001 or 002. Default: 001.
encodingGirocodeEncodingGirocodeEncoding. ISO_8859_1Encoding of the Girocode payload. Default: ISO-8859-1

Good to know

Important: As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().

Girocode competes (atleast for German-speaking countries) with the Bezahlcode. Even if Girocode has less features, it is more common than Bezahlcode. So choose the right payload type in respect of your users and the features you want to use.


3.8 Mail

Classname/Classfile: Mail / PayloadGenerator.cs

When to use?

Use it when you want to prepare/compose an email. Once scanned the code opens the default mail client with the given information like receiver, subject and message.

How to use it - simple way

Mailgenerator=newMail("john@doe.com","Look at this!","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is one overload:

Overload 1
Description: Creates a new mail with optional subject and body/message.

Parameter nameTypeDefaultDescription
mailReceiverstringnullReceiver's email address
subjectstringnullSubject line of the email
messagestringnullMessage content of the email
encodingMailEncodingMailEncoding.MAILTOPayload encoding type. Choose dependent on your QR Code scanner app.

Good to know

n/a


3.9 MMS

Classname/Classfile: MMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a MMS (message). You can choose if you want to prepare the message or just let the QR code open the messaging app with the correct phonenumber.

How to use it - simple way

MMSgenerator=newMMS("+491701234567","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new MMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingMMSEncodingMMSEncoding.MMSEncoding type

Overload 2
Description: (Pre-)composes a new MMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the MMS
encodingMMSEncodingMMSEncoding.MMSEncoding type

Good to know

This payload type supports (as some of the other payload types, too) different output formats. In most cases/regions you should use the MMSEncoding.MMS-type.


3.10 Monero address/payment

Classname/Classfile: MoneroTransaction / PayloadGenerator.cs

When to use?

This payload opens the user's Monero client/app and prefills its dialog with the given data. Either you pass only the Monero address or you add complete payment/transaction details.

How to use it - simple way

MoneroTransactiongenerator=newMoneroTransaction("46BeWrHpwXmHDpDEUmZBWZfoQpdc6HaERCNmx1pEYL2rAcuwufPN9rXHHtyUA4QVy66qeFQkn6sfK8aHYjA3jk3o1Bv16em");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a Monero payload.

Parameter nameTypeDefaultDescription
addressstringReceiver's monero address
txAmountfloat?nullAmount to transfer
txPaymentIdstringnullPayment id
recipientNamestringnullReceipient's name
txDescriptionstringnullReference text / payment description

Good to know

n/a


3.11 One-Time-Password

Classname/Classfile: OneTimePassword / PayloadGenerator.cs

When to use?

This payload generates a one-time-password QR code which is used for credential-exchange and authentification. You may use it in combination with the Google Authenticator.

How to use it - simple way

OneTimePasswordgenerator=newOneTimePassword(){Secret="pwq6 5q55",Issuer="Google",Label="test@google.com",};stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 0 special overloads. As can be seen in the example above these generator takes it values via properties.

Property nameTypeDefaultDescription
TypeOneTimePassword AuthTypeOneTimePasswordAuth Type.TOTPType of the one-time-password. Either TOTP or HOTP
AlgorithmOoneTimePassword AuthAlgorithmOoneTimePasswordAuth Algorithm.SHA1Algorith of the one-time-password. Either SHA1, SHA256 or SHA512
IssuerstringThe issuer's name
SecretstringThe Base32 encoded secret key
LabelstringThe label
Digitsint6Number of digits
Counterint?nullShall a counter be used?
Periodint?30Valid period

Good to know

The payload generator builds the correct payload for you, but it can't/doesn't calculate the TOTP/HOTP secret for you.


3.12 Phonenumber

Classname/Classfile: PhoneNumber / PayloadGenerator.cs

When to use?

Use it, when you wan't to share a phonenumber or when you want to use the QR code as CTA (call-to-action). Once scanned, the code opens the dialer app on the phone.

How to use it - simple way

PhoneNumbergenerator=newPhoneNumber("+491701234567");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a phone call payload.

Parameter nameTypeDefaultDescription
numberstringPhonenumber of the receiver

Good to know

There is no right or wrong formatting of the given phonenumber. Type the number in this way, you would type it into your phone's dialer.


3.13 RussiaPaymentOrder

Classname/Classfile: RussiaPaymentOrder / PayloadGenerator.cs

When to use?

Use it to generate QR codes for payments in Russia that are compliant to the standard ГОСТ Р 56042-2014.

How to use it - simple way

varaccount="40702810138250123017";varbic="044525225";varbankName="ОАО \"БАНК\"";varname="ООО «Три кита»";varcorrespAcc="30101810965770000413";vargenerator=newPayloadGenerator.RussiaPaymentOrder(name,account,bankName,bic,correspAcc);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(3);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a RussiaPaymentOrder configuration QR code payload.

Parameter nameTypeDefaultDescription
namestringName of the payee (Наименование получателя платежа)
personalAccstringBeneficiary account number (Номер счета получателя платежа)
bankNamestringName of the beneficiary's bank (Наименование банка получателя платежа)
BICstringBIC (БИК)
correspAccstringnullBox number / account payee's bank (Номер кор./сч. банка получателя платежа)
optionalFieldsOptionalFieldsnullOptional additional fields/information
characterSetCharacterSetsCharacterSets.utf_8Encoding of the payload string

Good to know

  • If CharacterSets was set to windows-1251 or koi8-r you should use ToBytes() instead of ToString() and pass the byte-array directly to CreateQrCode()!
  • The maximum length of a RussiaPaymentOrder is 300 byte as defined by the offical standard. Thus it isn't possible to use all additional fields at the same time.

3.14 Shadowsocks configuration

Classname/Classfile: ShadowSocksConfig / PayloadGenerator.cs

When to use?

Use it to share ShadowSocks (Proxy) configurations. When scanned, the QR scanner app should start the ShadowSocks with the given configuration.

How to use it - simple way

ShadowSocksConfiggenerator=newShadowSocksConfig("45.78.47.87",443,"laozhang",ShadowSocksConfig.Method.Aes256Cb);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a ShadowSocks configuration QR code payload.

Parameter nameTypeDefaultDescription
hostnamestringHostname of the ShadowSocks proxy
portintPort of the ShadowSocks proxy
passwordstringPassword of the SS proxy
methodMethodEncryption type
tagstringnullOptional tag line

Good to know

The value of port must be in the range within 1 and 65535. The tag parameter is optional.


3.15 Skype call

Classname/Classfile: SkypeCall / PayloadGenerator.cs

When to use?

Use it when you want to initiate Skype calls. When scanned, the QR scanner app opens skype and calls the user given to the payload generator.

How to use it - simple way

SkypeCallgenerator=newSkypeCall("johndoe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a skype call action payload.

Parameter nameTypeDefaultDescription
skypeUsernamestringSkype username which will be called

Good to know

n/a


3.16 SlovenianUpnQr

Classname/Classfile: SlovenianUpnQr / PayloadGenerator.cs

When to use?

Used for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order)

How to use it - simple way

varpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,recipientSiModel,recipientSiReference,code);//or if you need requested date of debitor’s payment (payment deadline) includedvarpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,deadline,recipientSiModel,recipientSiReference,code);QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);BitmapqrCodeImage=qrCode.GetGraphic(5);qrCodeImage.Save(@"GeneratedQRCode.bmp");

Parameter table

Parameter nameTypeMax LengthDefaultDescription
payerNamestring33Debitor (payer) name
payerAddressstring33Debitor (payer) address (Street name and house number)
payerPlacestring33Debitor (payer) place (Postal code and name)
recipientNamestring33Creditor (payee) name
recipientAddressstring33Creditor (payee) address (Street name and house number)
recipientPlacestring33Creditor (payee) place (Postal code and name)
recipientIbanstring34Creditor's IBAN
descriptionstring42Description/Comment
amountdoubleAmount (in EUR)
deadlineDateTime?Requested date of debitor's payment
recipientSiModelstring4SI99SI model
recipientSiReferencestring22SI reference
codestring4OTHRPurpose of Payment Code

Good to know

Important: As per official specification Slovenian UPN QR codes have to be generated with ECC-Level M (15%), ECI Mode set to ISO8859-2, Byte mode and QR Version of 15. If you pass the Payload-class itself to the QRCoder (as shown in the last example) then you don't have to set this parameters, since the Payload-class does this automatically.


3.17 SMS

Classname/Classfile: SMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a SMS (message). You can choose if you want to create the message including text or just let the QR code open the messaging app with the given phonenumber.

How to use it - simple way

SMSgenerator=newSMS("+491701234567","Hi John, do you remember SMS?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new SMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingSMSEncodingSMSEncoding.SMSEncoding type

Overload 2
Description: (Pre-)composes a new SMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the SMS
encodingSMSEncodingSMSEncoding.SMSEncoding type

Good to know

This payload supports different output formats. In most cases/regions you should use the SMSEncoding.SMS-type, which should work with the most scanner apps.


3.18 SwissQrCode (ISO-20022)

Classname/Classfile: SwissQRCode / PayloadGenerator.cs

When to use?

Opens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein). Note: Take care of the advices from the "Good to know" section.

How to use it - simple way

SwissQrCode.ContactcontactGeneral=SwissQrCode.Contact.WithStructuredAddress("John Doe","3003","Bern","CH","Parlamentsgebäude","1");SwissQrCode.Ibaniban=newSwissQrCode.Iban("CH2609000000857666015",PayloadGenerator.SwissQrCode.Iban.IbanType.QrIban);SwissQrCode.Referencereference=newSwissQrCode.Reference(SwissQrCode.Reference.ReferenceType.QRR,"990005000000000320071012303",SwissQrCode.Reference.ReferenceTextType.QrReference);SwissQrCode.AdditionalInformationadditionalInformation=newSwissQrCode.AdditionalInformation("This is my unstructured message.","Some bill information here...");SwissQrCode.Currencycurrency=SwissQrCode.Currency.CHF;decimalamount=100.25m;SwissQrCodepayload=newSwissQrCode(iban,currency,contactGeneral,additionalInformation,reference,null,amount,null,null);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20,Color.Black,Color.White,(Bitmap)Bitmap.FromFile(Application.StartupPath+"\\CH-Kreuz_7mm.png"),14,1);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a new Swiss Qr code.

Parameter nameTypeDefaultDescription
ibanIbanIBAN object
currencyCurrencyCurrency (either EUR or CHF)
creditorContactCreditor (payee) information
referenceReferenceReference information
additionalInformationAdditionalInformationnullAdditional information texts
debitorContactnullDebitor (payer) information
amountdecimal?nullAmount
requestedDateOfPaymentDateTime?nullObsoleteRequested date of debitor's payment
ultimateCreditorContactnullUltimate creditor information (use only in consultation with your bank!)
alternativeProcedure1stringnullOptional command for alternative processing mode - line 1
alternativeProcedure2stringnullOptional command for alternative processing mode - line 2

Good to know

  • Important: As per official specification Swiss QR codes have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().
  • Important: As per official specification a Swiss cross logo (can be downloaded here) has to be drawn on the code with a size of ~14%. (Per spec the Swiss cross has to be 7mm per side and the Swiss Qr code should be printed with 46mm without quiet zones or 49,2mm per side with quietzones. So we get 7/(49,2/100) = 14% icon size.)

3.19 URL

Classname/Classfile: Url / PayloadGenerator.cs

When to use?

Use it to share links/websites.

How to use it - simple way

Urlgenerator=newUrl("https://github.com/codebude/QRCoder/");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a link payload.

Parameter nameTypeDefaultDescription
urlstringLink url target

Good to know

If you a domain (without http:// or https://) is given, the payload generater prefixes the given url with http://.


3.20 WhatsAppMessage

Classname/Classfile: WhatsAppMessage / PayloadGenerator.cs

When to use?

Use it to share your WhatApp pre-composed WhatsAppMessages. Once scanned, the QR code opens a WhatsApp chat with the given message.

How to use it - simple way

WhatsAppMessagegenerator=newWhatsAppMessage("Hi John, what do you think about QR codes?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new WhatsApp message.

Parameter nameTypeDefaultDescription
messagestringThe message text

Overload 2
Description: Generates a new WhatsApp message towards a given contact.

Parameter nameTypeDefaultDescription
numberstringRecipient/contact number
messagestringThe message text

Good to know

-/-


3.21 WiFi

Classname/Classfile: WiFi / PayloadGenerator.cs

When to use?

Use it when you want to share WiFi credentials. Good for meetings, house partys and conventions.

How to use it - simple way

WiFigenerator=newWiFi("My-WiFis-Name","s3cr3t-p4ssw0rd",WiFi.Authentication.WPA);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates WiFi login credentials.

Parameter nameTypeDefaultDescription
ssidstringSSID of the WiFi network
passwordstringPassword of the WiFi network
authenticationModeAuthenticationAuthentification mode (WEP, WPA, WPA2)
isHiddenSSIDboolfalseSet flag to true, if the WiFi network hides its SSID
escapeHexStringsbooltrueSet flag to false, if SSID/password shouldn't be escaped, even if passed as HEX string

Good to know

  • Don't get confused when choosing authenticationMode-parameter. The value WiFi.Authentication.WPA also includes not only WPA but also WPA2!
  • For widest compatibility you may set escapeHexStrings to false, because if SSID/password are provided in HEX style ([A-F0-9] and will be escaped, the QR code may become unreadable by Apple devices. More info: )

4. Development of own payload types

Implementing your own, custom payload generator is quite easy. Simply create a new class for your custom payload and implement the QRCoder.PayloadGenerator.Payload-interface. The only method you have to implement/override is the ToString()-method.

publicclassHelloWorldPayload:Payload{privatestring_name;publicHelloWorldPayload(stringname){_name=name;}publicoverridestringToString(){return$"Hello {_name}";}}

If you have written a cool generator, feel free to send it in as PullRequest.

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Advanced usage Payload generators

Raffael Herrmann edited this page May 22, 2024 · 32 revisions
  1. Introduction to the "Payload Generator"
  2. Overview of the different payload types
  3. Usage of the payload generators
    3.1 BezahlCode
    3.2 Crypto Payment Address (e.g. Bitcoin, Litecoin, ...)
    3.3 Bookmark
    3.4 Calendar events (iCal/vEvent)
    3.5 ContactData (MeCard/vCard)
    3.6 Geolocation
    3.7 Girocode
    3.8 Mail
    3.9 MMS
    3.10 Monero address/payment
    3.11 One-Time-Password
    3.12 Phonenumber
    3.13 Russia Payment Order
    3.14 Shadowsocks configuration
    3.15 Skype call
    3.16 Slovenian QR Code for UPN QR Forms
    3.17 SMS
    3.18 SwissQrCode (ISO-20022)
    3.19 URL
    3.20 WhatsAppMessage
    3.21 WiFi
  4. Development of own payload types

1. Introduction to the "Payload Generator"

The payload generator is one of the things, which make the QRCoder unique. It's a class which helps to generate special payloads (=the text encoded in QR codes) that will start different actions on the device which scans the QR code.

Indeed a QR code can only encode a string (of text), but if this string has a special format, most* QR code scanners will perform a predefined action.

To help you to create these special formatted payload strings, we implemented the payload generators. These are easy-to-use classes, which check your data for invalid inputs and "automagically" create the fitting payload strings for you.

Info:Keep in mind, that all payload types stand and fall with the commitment between QR encoders and QR scanner apps. Special payload types aren't defined in the QR code standard (ISO/IEC 18004). Most of the QR code scanner apps are able to interpret the payload types described on this page. But in a real world application you should test your QR codes against the scanners your users will use.


2. Overview of the different payload types

Right now there are 19 different payload generators. To get a quick overview, have a look at the following table.

(Class-)NameWhat does it do, when scanned?Specification
BezahlCodeOpens the banking app for bank transfers, debits and banker's order. It's common in German-speaking countries and competes with the more common GiroCode.Bezahlcode specification
Bitcoin(LikeCryptoCurrency)AddressStarts crypto currency app for transfers.BIP 0021
BookmarkSaves a bookmark to the default webbrowser.NTTdocomo MEBKM
CalendarEventAdds an event to the user's calendar. Supports iCal and vEvent format.RFC 5545
ContactDataAdds a contact to the user's address book. Supports MeCard, vCard 2.1, vCard 3.0 and vCard 4.0 format.NTTdocomo MeCard, RFC 2425 (vCard 2.1), RFC 2426 (vCard 3.0), RFC 6350 (vCard 4.0)
GeolocationOpens the maps app and shows the given location or opens Google Maps in browser.RFC 5870
GirocodeOpens the banking app for bank transfers. It's common in the European region and competes with the less common BezahlCode.EPC069-12
MailOpens the default email app and composes a new message. Supports mailto:, MATMSG: and smtp: format.RFCRFC 6068, NTTdocomo MATMSG, smtp URI scheme
MMSOpens the standard messaging app and composes a new MMS. Either in mmsto: or in mms: format.RFC draft (mmsto), Data Services: Whitepaper (mms)
MoneroTransactionOpens the Monero wallet with transaction details.Monero URI scheme
OneTimePasswordEncoded secret keys. May be used in combination with Google Authenticator for example.Key URI Format
PhoneNumberOpens the phone's dialer app with given number.RFC 3966
ShadowSocksConfigOpens ShadowSocks app with given configuration.ShadowSocks URI scheme
SkypeCallOpens Skype app and calls given contact.Skype URI API reference
SlovenianUpnQrUsed for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order).Technical description, Advice for programmers
SMSOpen SMS app and composes new message. Supports sms:, sms: (for iOS) and SMSTO: format.RFC 5724 (sms), sms URI for iOS, SMSTO (not common)
SwissQrCodeOpens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein).ISO 20022
UrlOpens the given URL in default webbrowser.RFC 3986
WhatsAppMessageOpen whatsapp, lets you choose a contact and composes a new message with given text.WhatsApp URL Scheme
WiFiWhen scanned, the scanning device can login to the given WiFi without typing the credentials.Short description

3. Usage of the payload generators

3.1 BezahlCode

Classname/Classfile: BezahlCode / PayloadGenerator.cs

When to use?

Use it for banking (inlcuding bank transfers, debits, bank contacts and banker's order). It's used in German-speaking countries and competes with the more common GiroCode.

How to use it - simple way

The following code generates a payload for a simple SEPA payment to Wikimedia.

BezahlCodegenerator=newBezahlCode(BezahlCode.AuthorityType.singlepaymentsepa,"Wikimedia",iban:"DE33100205000001194700",bic:"BFSWDE33BER",amount:25.00m);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are four overloads:

Overload 1
Description: Creates a payload for SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 2
Description: Creates a payload for non SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 3
Description: Creates a payload for exchange of bank/payment contact data

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstring""Bank account (Kontonummer)
bncstring""Bank institute (Bankleitzahl)
ibanstring""IBAN
bicstring""BIC
reasonstring""Reason (Verwendungszweck)

Overload 4
Description: Generic constructor used by overload 1 and 2.

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)
internalModeint0Only used for internal state handdling

Good to know

BezahlCode is a format which competes with the GiroCode. Both can be used for banking purposes but GiroCode is a little more common and newer. Nevertheless BezahlCode has some more features like periodic transfer and debits. So before choose one of both, check which one fits your needs and which one is better supported by your users and their QR code scanner apps.


3.2 (Bitcoin like) Crypto Currency Payment Address

Classname/Classfile: BitcoinAddress|BitcoinCashAddress|LitecoinAddress / PayloadGenerator.cs

When to use?

Use this payload to share Bitcoin/Bitcoin Cash/Litecoin addresses or initiate payments in one of those currencies.

How to use it - simple way

BitcoinAddressgenerator=newPayloadGenerator.BitcoinAddress("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W",1.5d);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a Bitcoin address with or without amount to transfer and message.

Parameter nameTypeDefaultDescription
addressstringBitcoin address of the payment receiver
amountdouble?Amount of Bitcoins to transfer
labelstringnullReference label
messagestringnullReferece text aka message

Good to know

If you want to share only the crypto currency address without any amount of coins, set the variable amount to null. Replace "Bitcoin" by "BitcoinCash" or "Litecoin" to generate payloads for those currencies.


3.3 Bookmark

Classname/Classfile: Bookmark / PayloadGenerator.cs

When to use?

Use this payload, when you want to place a bookmark in the user's default webbrowser.

How to use it - simple way

Bookmarkgenerator=newBookmark("http://code-bude.net","Blog of QRCoder's father");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a bookmark payload including the bookmark title.

Parameter nameTypeDefaultDescription
urlstringUrl of the bookmark
titlestringTitle of the bookmark

Good to know

n/a


3.4 Calendar events (iCal/vEvent)

Classname/Classfile: CalendarEvent / PayloadGenerator.cs

When to use?

Use this payload to place an event to the user's calendar application.

How to use it - simple way

CalendarEventgenerator=newCalendarEvent("Birthday party","Join QRCoder's fourth birthday!","51.26118,6.6717",newDateTime(2017,10,13),newDateTime(2017,10,13),true);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeStart time of the event
endDateTimeEnd time of the event
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Overload 2
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeOffsetStart time of the event incl. offset in relation to UTC
endDateTimeOffsetEnd time of the event incl. offset in relation to UTC
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Good to know

The parameters description and location are optional. They can be set to null or string.Empty. If you want to place an event to Apple users you should use iCal instead of Universal as encoding.


3.5 ContactData (MeCard/vCard)

Classname/Classfile: ContactData / PayloadGenerator.cs

When to use?

Use it, when you want to share contact data/business cards. A QR code with this payload type will add the contact data to the user's address book.

How to use it - simple way

ContactDatagenerator=newContactData(ContactData.ContactOutputType.VCard3,"John","Doe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates contact data payload in different formats.

Parameter nameTypeDefaultDescription
outputTypeContactOutputTypePayload output type
firstnamestringThe firstname
lastnamestringThe lastname
nicknamestringnullThe displayname
phonestringnullNormal phone number
mobilePhonestringnullMobile phone
workPhonestringnullOffice phone number
emailstringnullE-Mail address
birthdayDateTime?nullBirthday
websitestringnullWebsite / Homepage
streetstringnullStreet
houseNumberstringnullHousenumber
citystringnullCity
zipCodestringnullZip code
countrystringnullCountry
notestringnullMemo text / notes
stateRegionstringnullState / Region
addressOrderAddressOrderAddressOrder.Defaultenum to define address order (see below)
orgstringnullOrganization/Company
orgTitlestringnullOrganization/Company title

Good to know

Via the parameter outputType you can choose between different formats. Supported formats are: vCard 2.1, vCard 3.0, vCard 4.0 and MeCard. Choose the format which fits your needs. Right now vCard 3.0 is the most used format.

The addressOrderenum specifies in which format the address is rendered. The two options are:

  • Default
    The address format used in European countries and others.
    Sample

    John Doe
    Königsallee 1
    40210 Düsseldorf
    Germany

  • Reversed
    The address format used in North America and others.
    Sample

    John Doe
    123 Fake St.
    Cleveland, OH, 12345
    USA


3.6 Geolocation

Classname/Classfile: Geolocation / PayloadGenerator.cs

When to use?

Use this payload type when you want to share a location. You can choose between the geo-format and Google Maps links.

How to use it - simple way

Geolocationgenerator=newGeolocation("51.26118","6.6717");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: The payload encodes a (geo-)location by its coordinates.

Parameter nameTypeDefaultDescription
latitudestringLatitude with . as splitter
longitudestringLongitude with . as splitter
encodingGeolocationEncodingGeolocationEncoding.GEOEncoding type - GEO or GoogleMaps

Good to know

If you use the geo-format the QR scanner app must support this tag. Most scanners do so. But if you want to be 100% on the safe side, choose Google Maps format because this generates a Google Maps (web-)link which can be interpreted by nearly any QR code scanner.


3.7 Girocode

Classname/Classfile: Girocode / PayloadGenerator.cs

When to use?

Use this payload type if you want to share payment contact information and/or bank transfer data. The Girocode is an European standard and supports SEPA payments.

How to use it - simple way

varpayload=newGirocode("DE33100205000001194700","BFSWDE33BER","Wikimedia",1337.99m);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates the Girocode payload with different options.

Parameter nameTypeDefaultDescription
ibanstringAccount number of the Beneficiary. Only IBAN is allowed.
bicstringBIC of the Beneficiary Bank.
namestringName of the Beneficiary.
amountdecimalAmount of the Credit Transfer in Euro. (Amount must be more than 0.01 and less than 999999999.99)
remittanceInformationstring""Remittance Information (Purpose-/reference text). (optional)
typeOfRemittanceTypeOfRemittanceTypeOfRemittance. UnstructuredType of remittance information. Either structured (e.g. ISO 11649 RF Creditor Reference) and max. 35 chars or unstructured and max. 140 chars.
purposeOfCreditTransferstring""Purpose of the Credit Transfer (optional)
messageToGirocodeUserstring""Beneficiary to originator information. (optional)
versionGirocodeVersionGirocodeVersion. Version1Girocode version. Either 001 or 002. Default: 001.
encodingGirocodeEncodingGirocodeEncoding. ISO_8859_1Encoding of the Girocode payload. Default: ISO-8859-1

Good to know

Important: As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().

Girocode competes (atleast for German-speaking countries) with the Bezahlcode. Even if Girocode has less features, it is more common than Bezahlcode. So choose the right payload type in respect of your users and the features you want to use.


3.8 Mail

Classname/Classfile: Mail / PayloadGenerator.cs

When to use?

Use it when you want to prepare/compose an email. Once scanned the code opens the default mail client with the given information like receiver, subject and message.

How to use it - simple way

Mailgenerator=newMail("john@doe.com","Look at this!","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is one overload:

Overload 1
Description: Creates a new mail with optional subject and body/message.

Parameter nameTypeDefaultDescription
mailReceiverstringnullReceiver's email address
subjectstringnullSubject line of the email
messagestringnullMessage content of the email
encodingMailEncodingMailEncoding.MAILTOPayload encoding type. Choose dependent on your QR Code scanner app.

Good to know

n/a


3.9 MMS

Classname/Classfile: MMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a MMS (message). You can choose if you want to prepare the message or just let the QR code open the messaging app with the correct phonenumber.

How to use it - simple way

MMSgenerator=newMMS("+491701234567","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new MMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingMMSEncodingMMSEncoding.MMSEncoding type

Overload 2
Description: (Pre-)composes a new MMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the MMS
encodingMMSEncodingMMSEncoding.MMSEncoding type

Good to know

This payload type supports (as some of the other payload types, too) different output formats. In most cases/regions you should use the MMSEncoding.MMS-type.


3.10 Monero address/payment

Classname/Classfile: MoneroTransaction / PayloadGenerator.cs

When to use?

This payload opens the user's Monero client/app and prefills its dialog with the given data. Either you pass only the Monero address or you add complete payment/transaction details.

How to use it - simple way

MoneroTransactiongenerator=newMoneroTransaction("46BeWrHpwXmHDpDEUmZBWZfoQpdc6HaERCNmx1pEYL2rAcuwufPN9rXHHtyUA4QVy66qeFQkn6sfK8aHYjA3jk3o1Bv16em");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a Monero payload.

Parameter nameTypeDefaultDescription
addressstringReceiver's monero address
txAmountfloat?nullAmount to transfer
txPaymentIdstringnullPayment id
recipientNamestringnullReceipient's name
txDescriptionstringnullReference text / payment description

Good to know

n/a


3.11 One-Time-Password

Classname/Classfile: OneTimePassword / PayloadGenerator.cs

When to use?

This payload generates a one-time-password QR code which is used for credential-exchange and authentification. You may use it in combination with the Google Authenticator.

How to use it - simple way

OneTimePasswordgenerator=newOneTimePassword(){Secret="pwq6 5q55",Issuer="Google",Label="test@google.com",};stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 0 special overloads. As can be seen in the example above these generator takes it values via properties.

Property nameTypeDefaultDescription
TypeOneTimePassword AuthTypeOneTimePasswordAuth Type.TOTPType of the one-time-password. Either TOTP or HOTP
AlgorithmOoneTimePassword AuthAlgorithmOoneTimePasswordAuth Algorithm.SHA1Algorith of the one-time-password. Either SHA1, SHA256 or SHA512
IssuerstringThe issuer's name
SecretstringThe Base32 encoded secret key
LabelstringThe label
Digitsint6Number of digits
Counterint?nullShall a counter be used?
Periodint?30Valid period

Good to know

The payload generator builds the correct payload for you, but it can't/doesn't calculate the TOTP/HOTP secret for you.


3.12 Phonenumber

Classname/Classfile: PhoneNumber / PayloadGenerator.cs

When to use?

Use it, when you wan't to share a phonenumber or when you want to use the QR code as CTA (call-to-action). Once scanned, the code opens the dialer app on the phone.

How to use it - simple way

PhoneNumbergenerator=newPhoneNumber("+491701234567");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a phone call payload.

Parameter nameTypeDefaultDescription
numberstringPhonenumber of the receiver

Good to know

There is no right or wrong formatting of the given phonenumber. Type the number in this way, you would type it into your phone's dialer.


3.13 RussiaPaymentOrder

Classname/Classfile: RussiaPaymentOrder / PayloadGenerator.cs

When to use?

Use it to generate QR codes for payments in Russia that are compliant to the standard ГОСТ Р 56042-2014.

How to use it - simple way

varaccount="40702810138250123017";varbic="044525225";varbankName="ОАО \"БАНК\"";varname="ООО «Три кита»";varcorrespAcc="30101810965770000413";vargenerator=newPayloadGenerator.RussiaPaymentOrder(name,account,bankName,bic,correspAcc);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(3);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a RussiaPaymentOrder configuration QR code payload.

Parameter nameTypeDefaultDescription
namestringName of the payee (Наименование получателя платежа)
personalAccstringBeneficiary account number (Номер счета получателя платежа)
bankNamestringName of the beneficiary's bank (Наименование банка получателя платежа)
BICstringBIC (БИК)
correspAccstringnullBox number / account payee's bank (Номер кор./сч. банка получателя платежа)
optionalFieldsOptionalFieldsnullOptional additional fields/information
characterSetCharacterSetsCharacterSets.utf_8Encoding of the payload string

Good to know

  • If CharacterSets was set to windows-1251 or koi8-r you should use ToBytes() instead of ToString() and pass the byte-array directly to CreateQrCode()!
  • The maximum length of a RussiaPaymentOrder is 300 byte as defined by the offical standard. Thus it isn't possible to use all additional fields at the same time.

3.14 Shadowsocks configuration

Classname/Classfile: ShadowSocksConfig / PayloadGenerator.cs

When to use?

Use it to share ShadowSocks (Proxy) configurations. When scanned, the QR scanner app should start the ShadowSocks with the given configuration.

How to use it - simple way

ShadowSocksConfiggenerator=newShadowSocksConfig("45.78.47.87",443,"laozhang",ShadowSocksConfig.Method.Aes256Cb);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a ShadowSocks configuration QR code payload.

Parameter nameTypeDefaultDescription
hostnamestringHostname of the ShadowSocks proxy
portintPort of the ShadowSocks proxy
passwordstringPassword of the SS proxy
methodMethodEncryption type
tagstringnullOptional tag line

Good to know

The value of port must be in the range within 1 and 65535. The tag parameter is optional.


3.15 Skype call

Classname/Classfile: SkypeCall / PayloadGenerator.cs

When to use?

Use it when you want to initiate Skype calls. When scanned, the QR scanner app opens skype and calls the user given to the payload generator.

How to use it - simple way

SkypeCallgenerator=newSkypeCall("johndoe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a skype call action payload.

Parameter nameTypeDefaultDescription
skypeUsernamestringSkype username which will be called

Good to know

n/a


3.16 SlovenianUpnQr

Classname/Classfile: SlovenianUpnQr / PayloadGenerator.cs

When to use?

Used for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order)

How to use it - simple way

varpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,recipientSiModel,recipientSiReference,code);//or if you need requested date of debitor’s payment (payment deadline) includedvarpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,deadline,recipientSiModel,recipientSiReference,code);QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);BitmapqrCodeImage=qrCode.GetGraphic(5);qrCodeImage.Save(@"GeneratedQRCode.bmp");

Parameter table

Parameter nameTypeMax LengthDefaultDescription
payerNamestring33Debitor (payer) name
payerAddressstring33Debitor (payer) address (Street name and house number)
payerPlacestring33Debitor (payer) place (Postal code and name)
recipientNamestring33Creditor (payee) name
recipientAddressstring33Creditor (payee) address (Street name and house number)
recipientPlacestring33Creditor (payee) place (Postal code and name)
recipientIbanstring34Creditor's IBAN
descriptionstring42Description/Comment
amountdoubleAmount (in EUR)
deadlineDateTime?Requested date of debitor's payment
recipientSiModelstring4SI99SI model
recipientSiReferencestring22SI reference
codestring4OTHRPurpose of Payment Code

Good to know

Important: As per official specification Slovenian UPN QR codes have to be generated with ECC-Level M (15%), ECI Mode set to ISO8859-2, Byte mode and QR Version of 15. If you pass the Payload-class itself to the QRCoder (as shown in the last example) then you don't have to set this parameters, since the Payload-class does this automatically.


3.17 SMS

Classname/Classfile: SMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a SMS (message). You can choose if you want to create the message including text or just let the QR code open the messaging app with the given phonenumber.

How to use it - simple way

SMSgenerator=newSMS("+491701234567","Hi John, do you remember SMS?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new SMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingSMSEncodingSMSEncoding.SMSEncoding type

Overload 2
Description: (Pre-)composes a new SMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the SMS
encodingSMSEncodingSMSEncoding.SMSEncoding type

Good to know

This payload supports different output formats. In most cases/regions you should use the SMSEncoding.SMS-type, which should work with the most scanner apps.


3.18 SwissQrCode (ISO-20022)

Classname/Classfile: SwissQRCode / PayloadGenerator.cs

When to use?

Opens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein). Note: Take care of the advices from the "Good to know" section.

How to use it - simple way

SwissQrCode.ContactcontactGeneral=SwissQrCode.Contact.WithStructuredAddress("John Doe","3003","Bern","CH","Parlamentsgebäude","1");SwissQrCode.Ibaniban=newSwissQrCode.Iban("CH2609000000857666015",PayloadGenerator.SwissQrCode.Iban.IbanType.QrIban);SwissQrCode.Referencereference=newSwissQrCode.Reference(SwissQrCode.Reference.ReferenceType.QRR,"990005000000000320071012303",SwissQrCode.Reference.ReferenceTextType.QrReference);SwissQrCode.AdditionalInformationadditionalInformation=newSwissQrCode.AdditionalInformation("This is my unstructured message.","Some bill information here...");SwissQrCode.Currencycurrency=SwissQrCode.Currency.CHF;decimalamount=100.25m;SwissQrCodepayload=newSwissQrCode(iban,currency,contactGeneral,additionalInformation,reference,null,amount,null,null);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20,Color.Black,Color.White,(Bitmap)Bitmap.FromFile(Application.StartupPath+"\\CH-Kreuz_7mm.png"),14,1);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a new Swiss Qr code.

Parameter nameTypeDefaultDescription
ibanIbanIBAN object
currencyCurrencyCurrency (either EUR or CHF)
creditorContactCreditor (payee) information
referenceReferenceReference information
additionalInformationAdditionalInformationnullAdditional information texts
debitorContactnullDebitor (payer) information
amountdecimal?nullAmount
requestedDateOfPaymentDateTime?nullObsoleteRequested date of debitor's payment
ultimateCreditorContactnullUltimate creditor information (use only in consultation with your bank!)
alternativeProcedure1stringnullOptional command for alternative processing mode - line 1
alternativeProcedure2stringnullOptional command for alternative processing mode - line 2

Good to know

  • Important: As per official specification Swiss QR codes have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().
  • Important: As per official specification a Swiss cross logo (can be downloaded here) has to be drawn on the code with a size of ~14%. (Per spec the Swiss cross has to be 7mm per side and the Swiss Qr code should be printed with 46mm without quiet zones or 49,2mm per side with quietzones. So we get 7/(49,2/100) = 14% icon size.)

3.19 URL

Classname/Classfile: Url / PayloadGenerator.cs

When to use?

Use it to share links/websites.

How to use it - simple way

Urlgenerator=newUrl("https://github.com/codebude/QRCoder/");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a link payload.

Parameter nameTypeDefaultDescription
urlstringLink url target

Good to know

If you a domain (without http:// or https://) is given, the payload generater prefixes the given url with http://.


3.20 WhatsAppMessage

Classname/Classfile: WhatsAppMessage / PayloadGenerator.cs

When to use?

Use it to share your WhatApp pre-composed WhatsAppMessages. Once scanned, the QR code opens a WhatsApp chat with the given message.

How to use it - simple way

WhatsAppMessagegenerator=newWhatsAppMessage("Hi John, what do you think about QR codes?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new WhatsApp message.

Parameter nameTypeDefaultDescription
messagestringThe message text

Overload 2
Description: Generates a new WhatsApp message towards a given contact.

Parameter nameTypeDefaultDescription
numberstringRecipient/contact number
messagestringThe message text

Good to know

-/-


3.21 WiFi

Classname/Classfile: WiFi / PayloadGenerator.cs

When to use?

Use it when you want to share WiFi credentials. Good for meetings, house partys and conventions.

How to use it - simple way

WiFigenerator=newWiFi("My-WiFis-Name","s3cr3t-p4ssw0rd",WiFi.Authentication.WPA);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates WiFi login credentials.

Parameter nameTypeDefaultDescription
ssidstringSSID of the WiFi network
passwordstringPassword of the WiFi network
authenticationModeAuthenticationAuthentification mode (WEP, WPA, WPA2)
isHiddenSSIDboolfalseSet flag to true, if the WiFi network hides its SSID
escapeHexStringsbooltrueSet flag to false, if SSID/password shouldn't be escaped, even if passed as HEX string

Good to know

  • Don't get confused when choosing authenticationMode-parameter. The value WiFi.Authentication.WPA also includes not only WPA but also WPA2!
  • For widest compatibility you may set escapeHexStrings to false, because if SSID/password are provided in HEX style ([A-F0-9] and will be escaped, the QR code may become unreadable by Apple devices. More info: )

4. Development of own payload types

Implementing your own, custom payload generator is quite easy. Simply create a new class for your custom payload and implement the QRCoder.PayloadGenerator.Payload-interface. The only method you have to implement/override is the ToString()-method.

publicclassHelloWorldPayload:Payload{privatestring_name;publicHelloWorldPayload(stringname){_name=name;}publicoverridestringToString(){return$"Hello {_name}";}}

If you have written a cool generator, feel free to send it in as PullRequest.

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Advanced usage Payload generators

Raffael Herrmann edited this page May 22, 2024 · 32 revisions
  1. Introduction to the "Payload Generator"
  2. Overview of the different payload types
  3. Usage of the payload generators
    3.1 BezahlCode
    3.2 Crypto Payment Address (e.g. Bitcoin, Litecoin, ...)
    3.3 Bookmark
    3.4 Calendar events (iCal/vEvent)
    3.5 ContactData (MeCard/vCard)
    3.6 Geolocation
    3.7 Girocode
    3.8 Mail
    3.9 MMS
    3.10 Monero address/payment
    3.11 One-Time-Password
    3.12 Phonenumber
    3.13 Russia Payment Order
    3.14 Shadowsocks configuration
    3.15 Skype call
    3.16 Slovenian QR Code for UPN QR Forms
    3.17 SMS
    3.18 SwissQrCode (ISO-20022)
    3.19 URL
    3.20 WhatsAppMessage
    3.21 WiFi
  4. Development of own payload types

1. Introduction to the "Payload Generator"

The payload generator is one of the things, which make the QRCoder unique. It's a class which helps to generate special payloads (=the text encoded in QR codes) that will start different actions on the device which scans the QR code.

Indeed a QR code can only encode a string (of text), but if this string has a special format, most* QR code scanners will perform a predefined action.

To help you to create these special formatted payload strings, we implemented the payload generators. These are easy-to-use classes, which check your data for invalid inputs and "automagically" create the fitting payload strings for you.

Info:Keep in mind, that all payload types stand and fall with the commitment between QR encoders and QR scanner apps. Special payload types aren't defined in the QR code standard (ISO/IEC 18004). Most of the QR code scanner apps are able to interpret the payload types described on this page. But in a real world application you should test your QR codes against the scanners your users will use.


2. Overview of the different payload types

Right now there are 19 different payload generators. To get a quick overview, have a look at the following table.

(Class-)NameWhat does it do, when scanned?Specification
BezahlCodeOpens the banking app for bank transfers, debits and banker's order. It's common in German-speaking countries and competes with the more common GiroCode.Bezahlcode specification
Bitcoin(LikeCryptoCurrency)AddressStarts crypto currency app for transfers.BIP 0021
BookmarkSaves a bookmark to the default webbrowser.NTTdocomo MEBKM
CalendarEventAdds an event to the user's calendar. Supports iCal and vEvent format.RFC 5545
ContactDataAdds a contact to the user's address book. Supports MeCard, vCard 2.1, vCard 3.0 and vCard 4.0 format.NTTdocomo MeCard, RFC 2425 (vCard 2.1), RFC 2426 (vCard 3.0), RFC 6350 (vCard 4.0)
GeolocationOpens the maps app and shows the given location or opens Google Maps in browser.RFC 5870
GirocodeOpens the banking app for bank transfers. It's common in the European region and competes with the less common BezahlCode.EPC069-12
MailOpens the default email app and composes a new message. Supports mailto:, MATMSG: and smtp: format.RFCRFC 6068, NTTdocomo MATMSG, smtp URI scheme
MMSOpens the standard messaging app and composes a new MMS. Either in mmsto: or in mms: format.RFC draft (mmsto), Data Services: Whitepaper (mms)
MoneroTransactionOpens the Monero wallet with transaction details.Monero URI scheme
OneTimePasswordEncoded secret keys. May be used in combination with Google Authenticator for example.Key URI Format
PhoneNumberOpens the phone's dialer app with given number.RFC 3966
ShadowSocksConfigOpens ShadowSocks app with given configuration.ShadowSocks URI scheme
SkypeCallOpens Skype app and calls given contact.Skype URI API reference
SlovenianUpnQrUsed for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order).Technical description, Advice for programmers
SMSOpen SMS app and composes new message. Supports sms:, sms: (for iOS) and SMSTO: format.RFC 5724 (sms), sms URI for iOS, SMSTO (not common)
SwissQrCodeOpens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein).ISO 20022
UrlOpens the given URL in default webbrowser.RFC 3986
WhatsAppMessageOpen whatsapp, lets you choose a contact and composes a new message with given text.WhatsApp URL Scheme
WiFiWhen scanned, the scanning device can login to the given WiFi without typing the credentials.Short description

3. Usage of the payload generators

3.1 BezahlCode

Classname/Classfile: BezahlCode / PayloadGenerator.cs

When to use?

Use it for banking (inlcuding bank transfers, debits, bank contacts and banker's order). It's used in German-speaking countries and competes with the more common GiroCode.

How to use it - simple way

The following code generates a payload for a simple SEPA payment to Wikimedia.

BezahlCodegenerator=newBezahlCode(BezahlCode.AuthorityType.singlepaymentsepa,"Wikimedia",iban:"DE33100205000001194700",bic:"BFSWDE33BER",amount:25.00m);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are four overloads:

Overload 1
Description: Creates a payload for SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 2
Description: Creates a payload for non SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 3
Description: Creates a payload for exchange of bank/payment contact data

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstring""Bank account (Kontonummer)
bncstring""Bank institute (Bankleitzahl)
ibanstring""IBAN
bicstring""BIC
reasonstring""Reason (Verwendungszweck)

Overload 4
Description: Generic constructor used by overload 1 and 2.

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)
internalModeint0Only used for internal state handdling

Good to know

BezahlCode is a format which competes with the GiroCode. Both can be used for banking purposes but GiroCode is a little more common and newer. Nevertheless BezahlCode has some more features like periodic transfer and debits. So before choose one of both, check which one fits your needs and which one is better supported by your users and their QR code scanner apps.


3.2 (Bitcoin like) Crypto Currency Payment Address

Classname/Classfile: BitcoinAddress|BitcoinCashAddress|LitecoinAddress / PayloadGenerator.cs

When to use?

Use this payload to share Bitcoin/Bitcoin Cash/Litecoin addresses or initiate payments in one of those currencies.

How to use it - simple way

BitcoinAddressgenerator=newPayloadGenerator.BitcoinAddress("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W",1.5d);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a Bitcoin address with or without amount to transfer and message.

Parameter nameTypeDefaultDescription
addressstringBitcoin address of the payment receiver
amountdouble?Amount of Bitcoins to transfer
labelstringnullReference label
messagestringnullReferece text aka message

Good to know

If you want to share only the crypto currency address without any amount of coins, set the variable amount to null. Replace "Bitcoin" by "BitcoinCash" or "Litecoin" to generate payloads for those currencies.


3.3 Bookmark

Classname/Classfile: Bookmark / PayloadGenerator.cs

When to use?

Use this payload, when you want to place a bookmark in the user's default webbrowser.

How to use it - simple way

Bookmarkgenerator=newBookmark("http://code-bude.net","Blog of QRCoder's father");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a bookmark payload including the bookmark title.

Parameter nameTypeDefaultDescription
urlstringUrl of the bookmark
titlestringTitle of the bookmark

Good to know

n/a


3.4 Calendar events (iCal/vEvent)

Classname/Classfile: CalendarEvent / PayloadGenerator.cs

When to use?

Use this payload to place an event to the user's calendar application.

How to use it - simple way

CalendarEventgenerator=newCalendarEvent("Birthday party","Join QRCoder's fourth birthday!","51.26118,6.6717",newDateTime(2017,10,13),newDateTime(2017,10,13),true);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeStart time of the event
endDateTimeEnd time of the event
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Overload 2
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeOffsetStart time of the event incl. offset in relation to UTC
endDateTimeOffsetEnd time of the event incl. offset in relation to UTC
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Good to know

The parameters description and location are optional. They can be set to null or string.Empty. If you want to place an event to Apple users you should use iCal instead of Universal as encoding.


3.5 ContactData (MeCard/vCard)

Classname/Classfile: ContactData / PayloadGenerator.cs

When to use?

Use it, when you want to share contact data/business cards. A QR code with this payload type will add the contact data to the user's address book.

How to use it - simple way

ContactDatagenerator=newContactData(ContactData.ContactOutputType.VCard3,"John","Doe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates contact data payload in different formats.

Parameter nameTypeDefaultDescription
outputTypeContactOutputTypePayload output type
firstnamestringThe firstname
lastnamestringThe lastname
nicknamestringnullThe displayname
phonestringnullNormal phone number
mobilePhonestringnullMobile phone
workPhonestringnullOffice phone number
emailstringnullE-Mail address
birthdayDateTime?nullBirthday
websitestringnullWebsite / Homepage
streetstringnullStreet
houseNumberstringnullHousenumber
citystringnullCity
zipCodestringnullZip code
countrystringnullCountry
notestringnullMemo text / notes
stateRegionstringnullState / Region
addressOrderAddressOrderAddressOrder.Defaultenum to define address order (see below)
orgstringnullOrganization/Company
orgTitlestringnullOrganization/Company title

Good to know

Via the parameter outputType you can choose between different formats. Supported formats are: vCard 2.1, vCard 3.0, vCard 4.0 and MeCard. Choose the format which fits your needs. Right now vCard 3.0 is the most used format.

The addressOrderenum specifies in which format the address is rendered. The two options are:

  • Default
    The address format used in European countries and others.
    Sample

    John Doe
    Königsallee 1
    40210 Düsseldorf
    Germany

  • Reversed
    The address format used in North America and others.
    Sample

    John Doe
    123 Fake St.
    Cleveland, OH, 12345
    USA


3.6 Geolocation

Classname/Classfile: Geolocation / PayloadGenerator.cs

When to use?

Use this payload type when you want to share a location. You can choose between the geo-format and Google Maps links.

How to use it - simple way

Geolocationgenerator=newGeolocation("51.26118","6.6717");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: The payload encodes a (geo-)location by its coordinates.

Parameter nameTypeDefaultDescription
latitudestringLatitude with . as splitter
longitudestringLongitude with . as splitter
encodingGeolocationEncodingGeolocationEncoding.GEOEncoding type - GEO or GoogleMaps

Good to know

If you use the geo-format the QR scanner app must support this tag. Most scanners do so. But if you want to be 100% on the safe side, choose Google Maps format because this generates a Google Maps (web-)link which can be interpreted by nearly any QR code scanner.


3.7 Girocode

Classname/Classfile: Girocode / PayloadGenerator.cs

When to use?

Use this payload type if you want to share payment contact information and/or bank transfer data. The Girocode is an European standard and supports SEPA payments.

How to use it - simple way

varpayload=newGirocode("DE33100205000001194700","BFSWDE33BER","Wikimedia",1337.99m);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates the Girocode payload with different options.

Parameter nameTypeDefaultDescription
ibanstringAccount number of the Beneficiary. Only IBAN is allowed.
bicstringBIC of the Beneficiary Bank.
namestringName of the Beneficiary.
amountdecimalAmount of the Credit Transfer in Euro. (Amount must be more than 0.01 and less than 999999999.99)
remittanceInformationstring""Remittance Information (Purpose-/reference text). (optional)
typeOfRemittanceTypeOfRemittanceTypeOfRemittance. UnstructuredType of remittance information. Either structured (e.g. ISO 11649 RF Creditor Reference) and max. 35 chars or unstructured and max. 140 chars.
purposeOfCreditTransferstring""Purpose of the Credit Transfer (optional)
messageToGirocodeUserstring""Beneficiary to originator information. (optional)
versionGirocodeVersionGirocodeVersion. Version1Girocode version. Either 001 or 002. Default: 001.
encodingGirocodeEncodingGirocodeEncoding. ISO_8859_1Encoding of the Girocode payload. Default: ISO-8859-1

Good to know

Important: As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().

Girocode competes (atleast for German-speaking countries) with the Bezahlcode. Even if Girocode has less features, it is more common than Bezahlcode. So choose the right payload type in respect of your users and the features you want to use.


3.8 Mail

Classname/Classfile: Mail / PayloadGenerator.cs

When to use?

Use it when you want to prepare/compose an email. Once scanned the code opens the default mail client with the given information like receiver, subject and message.

How to use it - simple way

Mailgenerator=newMail("john@doe.com","Look at this!","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is one overload:

Overload 1
Description: Creates a new mail with optional subject and body/message.

Parameter nameTypeDefaultDescription
mailReceiverstringnullReceiver's email address
subjectstringnullSubject line of the email
messagestringnullMessage content of the email
encodingMailEncodingMailEncoding.MAILTOPayload encoding type. Choose dependent on your QR Code scanner app.

Good to know

n/a


3.9 MMS

Classname/Classfile: MMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a MMS (message). You can choose if you want to prepare the message or just let the QR code open the messaging app with the correct phonenumber.

How to use it - simple way

MMSgenerator=newMMS("+491701234567","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new MMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingMMSEncodingMMSEncoding.MMSEncoding type

Overload 2
Description: (Pre-)composes a new MMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the MMS
encodingMMSEncodingMMSEncoding.MMSEncoding type

Good to know

This payload type supports (as some of the other payload types, too) different output formats. In most cases/regions you should use the MMSEncoding.MMS-type.


3.10 Monero address/payment

Classname/Classfile: MoneroTransaction / PayloadGenerator.cs

When to use?

This payload opens the user's Monero client/app and prefills its dialog with the given data. Either you pass only the Monero address or you add complete payment/transaction details.

How to use it - simple way

MoneroTransactiongenerator=newMoneroTransaction("46BeWrHpwXmHDpDEUmZBWZfoQpdc6HaERCNmx1pEYL2rAcuwufPN9rXHHtyUA4QVy66qeFQkn6sfK8aHYjA3jk3o1Bv16em");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a Monero payload.

Parameter nameTypeDefaultDescription
addressstringReceiver's monero address
txAmountfloat?nullAmount to transfer
txPaymentIdstringnullPayment id
recipientNamestringnullReceipient's name
txDescriptionstringnullReference text / payment description

Good to know

n/a


3.11 One-Time-Password

Classname/Classfile: OneTimePassword / PayloadGenerator.cs

When to use?

This payload generates a one-time-password QR code which is used for credential-exchange and authentification. You may use it in combination with the Google Authenticator.

How to use it - simple way

OneTimePasswordgenerator=newOneTimePassword(){Secret="pwq6 5q55",Issuer="Google",Label="test@google.com",};stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 0 special overloads. As can be seen in the example above these generator takes it values via properties.

Property nameTypeDefaultDescription
TypeOneTimePassword AuthTypeOneTimePasswordAuth Type.TOTPType of the one-time-password. Either TOTP or HOTP
AlgorithmOoneTimePassword AuthAlgorithmOoneTimePasswordAuth Algorithm.SHA1Algorith of the one-time-password. Either SHA1, SHA256 or SHA512
IssuerstringThe issuer's name
SecretstringThe Base32 encoded secret key
LabelstringThe label
Digitsint6Number of digits
Counterint?nullShall a counter be used?
Periodint?30Valid period

Good to know

The payload generator builds the correct payload for you, but it can't/doesn't calculate the TOTP/HOTP secret for you.


3.12 Phonenumber

Classname/Classfile: PhoneNumber / PayloadGenerator.cs

When to use?

Use it, when you wan't to share a phonenumber or when you want to use the QR code as CTA (call-to-action). Once scanned, the code opens the dialer app on the phone.

How to use it - simple way

PhoneNumbergenerator=newPhoneNumber("+491701234567");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a phone call payload.

Parameter nameTypeDefaultDescription
numberstringPhonenumber of the receiver

Good to know

There is no right or wrong formatting of the given phonenumber. Type the number in this way, you would type it into your phone's dialer.


3.13 RussiaPaymentOrder

Classname/Classfile: RussiaPaymentOrder / PayloadGenerator.cs

When to use?

Use it to generate QR codes for payments in Russia that are compliant to the standard ГОСТ Р 56042-2014.

How to use it - simple way

varaccount="40702810138250123017";varbic="044525225";varbankName="ОАО \"БАНК\"";varname="ООО «Три кита»";varcorrespAcc="30101810965770000413";vargenerator=newPayloadGenerator.RussiaPaymentOrder(name,account,bankName,bic,correspAcc);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(3);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a RussiaPaymentOrder configuration QR code payload.

Parameter nameTypeDefaultDescription
namestringName of the payee (Наименование получателя платежа)
personalAccstringBeneficiary account number (Номер счета получателя платежа)
bankNamestringName of the beneficiary's bank (Наименование банка получателя платежа)
BICstringBIC (БИК)
correspAccstringnullBox number / account payee's bank (Номер кор./сч. банка получателя платежа)
optionalFieldsOptionalFieldsnullOptional additional fields/information
characterSetCharacterSetsCharacterSets.utf_8Encoding of the payload string

Good to know

  • If CharacterSets was set to windows-1251 or koi8-r you should use ToBytes() instead of ToString() and pass the byte-array directly to CreateQrCode()!
  • The maximum length of a RussiaPaymentOrder is 300 byte as defined by the offical standard. Thus it isn't possible to use all additional fields at the same time.

3.14 Shadowsocks configuration

Classname/Classfile: ShadowSocksConfig / PayloadGenerator.cs

When to use?

Use it to share ShadowSocks (Proxy) configurations. When scanned, the QR scanner app should start the ShadowSocks with the given configuration.

How to use it - simple way

ShadowSocksConfiggenerator=newShadowSocksConfig("45.78.47.87",443,"laozhang",ShadowSocksConfig.Method.Aes256Cb);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a ShadowSocks configuration QR code payload.

Parameter nameTypeDefaultDescription
hostnamestringHostname of the ShadowSocks proxy
portintPort of the ShadowSocks proxy
passwordstringPassword of the SS proxy
methodMethodEncryption type
tagstringnullOptional tag line

Good to know

The value of port must be in the range within 1 and 65535. The tag parameter is optional.


3.15 Skype call

Classname/Classfile: SkypeCall / PayloadGenerator.cs

When to use?

Use it when you want to initiate Skype calls. When scanned, the QR scanner app opens skype and calls the user given to the payload generator.

How to use it - simple way

SkypeCallgenerator=newSkypeCall("johndoe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a skype call action payload.

Parameter nameTypeDefaultDescription
skypeUsernamestringSkype username which will be called

Good to know

n/a


3.16 SlovenianUpnQr

Classname/Classfile: SlovenianUpnQr / PayloadGenerator.cs

When to use?

Used for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order)

How to use it - simple way

varpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,recipientSiModel,recipientSiReference,code);//or if you need requested date of debitor’s payment (payment deadline) includedvarpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,deadline,recipientSiModel,recipientSiReference,code);QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);BitmapqrCodeImage=qrCode.GetGraphic(5);qrCodeImage.Save(@"GeneratedQRCode.bmp");

Parameter table

Parameter nameTypeMax LengthDefaultDescription
payerNamestring33Debitor (payer) name
payerAddressstring33Debitor (payer) address (Street name and house number)
payerPlacestring33Debitor (payer) place (Postal code and name)
recipientNamestring33Creditor (payee) name
recipientAddressstring33Creditor (payee) address (Street name and house number)
recipientPlacestring33Creditor (payee) place (Postal code and name)
recipientIbanstring34Creditor's IBAN
descriptionstring42Description/Comment
amountdoubleAmount (in EUR)
deadlineDateTime?Requested date of debitor's payment
recipientSiModelstring4SI99SI model
recipientSiReferencestring22SI reference
codestring4OTHRPurpose of Payment Code

Good to know

Important: As per official specification Slovenian UPN QR codes have to be generated with ECC-Level M (15%), ECI Mode set to ISO8859-2, Byte mode and QR Version of 15. If you pass the Payload-class itself to the QRCoder (as shown in the last example) then you don't have to set this parameters, since the Payload-class does this automatically.


3.17 SMS

Classname/Classfile: SMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a SMS (message). You can choose if you want to create the message including text or just let the QR code open the messaging app with the given phonenumber.

How to use it - simple way

SMSgenerator=newSMS("+491701234567","Hi John, do you remember SMS?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new SMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingSMSEncodingSMSEncoding.SMSEncoding type

Overload 2
Description: (Pre-)composes a new SMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the SMS
encodingSMSEncodingSMSEncoding.SMSEncoding type

Good to know

This payload supports different output formats. In most cases/regions you should use the SMSEncoding.SMS-type, which should work with the most scanner apps.


3.18 SwissQrCode (ISO-20022)

Classname/Classfile: SwissQRCode / PayloadGenerator.cs

When to use?

Opens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein). Note: Take care of the advices from the "Good to know" section.

How to use it - simple way

SwissQrCode.ContactcontactGeneral=SwissQrCode.Contact.WithStructuredAddress("John Doe","3003","Bern","CH","Parlamentsgebäude","1");SwissQrCode.Ibaniban=newSwissQrCode.Iban("CH2609000000857666015",PayloadGenerator.SwissQrCode.Iban.IbanType.QrIban);SwissQrCode.Referencereference=newSwissQrCode.Reference(SwissQrCode.Reference.ReferenceType.QRR,"990005000000000320071012303",SwissQrCode.Reference.ReferenceTextType.QrReference);SwissQrCode.AdditionalInformationadditionalInformation=newSwissQrCode.AdditionalInformation("This is my unstructured message.","Some bill information here...");SwissQrCode.Currencycurrency=SwissQrCode.Currency.CHF;decimalamount=100.25m;SwissQrCodepayload=newSwissQrCode(iban,currency,contactGeneral,additionalInformation,reference,null,amount,null,null);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20,Color.Black,Color.White,(Bitmap)Bitmap.FromFile(Application.StartupPath+"\\CH-Kreuz_7mm.png"),14,1);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a new Swiss Qr code.

Parameter nameTypeDefaultDescription
ibanIbanIBAN object
currencyCurrencyCurrency (either EUR or CHF)
creditorContactCreditor (payee) information
referenceReferenceReference information
additionalInformationAdditionalInformationnullAdditional information texts
debitorContactnullDebitor (payer) information
amountdecimal?nullAmount
requestedDateOfPaymentDateTime?nullObsoleteRequested date of debitor's payment
ultimateCreditorContactnullUltimate creditor information (use only in consultation with your bank!)
alternativeProcedure1stringnullOptional command for alternative processing mode - line 1
alternativeProcedure2stringnullOptional command for alternative processing mode - line 2

Good to know

  • Important: As per official specification Swiss QR codes have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().
  • Important: As per official specification a Swiss cross logo (can be downloaded here) has to be drawn on the code with a size of ~14%. (Per spec the Swiss cross has to be 7mm per side and the Swiss Qr code should be printed with 46mm without quiet zones or 49,2mm per side with quietzones. So we get 7/(49,2/100) = 14% icon size.)

3.19 URL

Classname/Classfile: Url / PayloadGenerator.cs

When to use?

Use it to share links/websites.

How to use it - simple way

Urlgenerator=newUrl("https://github.com/codebude/QRCoder/");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a link payload.

Parameter nameTypeDefaultDescription
urlstringLink url target

Good to know

If you a domain (without http:// or https://) is given, the payload generater prefixes the given url with http://.


3.20 WhatsAppMessage

Classname/Classfile: WhatsAppMessage / PayloadGenerator.cs

When to use?

Use it to share your WhatApp pre-composed WhatsAppMessages. Once scanned, the QR code opens a WhatsApp chat with the given message.

How to use it - simple way

WhatsAppMessagegenerator=newWhatsAppMessage("Hi John, what do you think about QR codes?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new WhatsApp message.

Parameter nameTypeDefaultDescription
messagestringThe message text

Overload 2
Description: Generates a new WhatsApp message towards a given contact.

Parameter nameTypeDefaultDescription
numberstringRecipient/contact number
messagestringThe message text

Good to know

-/-


3.21 WiFi

Classname/Classfile: WiFi / PayloadGenerator.cs

When to use?

Use it when you want to share WiFi credentials. Good for meetings, house partys and conventions.

How to use it - simple way

WiFigenerator=newWiFi("My-WiFis-Name","s3cr3t-p4ssw0rd",WiFi.Authentication.WPA);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates WiFi login credentials.

Parameter nameTypeDefaultDescription
ssidstringSSID of the WiFi network
passwordstringPassword of the WiFi network
authenticationModeAuthenticationAuthentification mode (WEP, WPA, WPA2)
isHiddenSSIDboolfalseSet flag to true, if the WiFi network hides its SSID
escapeHexStringsbooltrueSet flag to false, if SSID/password shouldn't be escaped, even if passed as HEX string

Good to know

  • Don't get confused when choosing authenticationMode-parameter. The value WiFi.Authentication.WPA also includes not only WPA but also WPA2!
  • For widest compatibility you may set escapeHexStrings to false, because if SSID/password are provided in HEX style ([A-F0-9] and will be escaped, the QR code may become unreadable by Apple devices. More info: )

4. Development of own payload types

Implementing your own, custom payload generator is quite easy. Simply create a new class for your custom payload and implement the QRCoder.PayloadGenerator.Payload-interface. The only method you have to implement/override is the ToString()-method.

publicclassHelloWorldPayload:Payload{privatestring_name;publicHelloWorldPayload(stringname){_name=name;}publicoverridestringToString(){return$"Hello {_name}";}}

If you have written a cool generator, feel free to send it in as PullRequest.

Clone this wiki locally

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Advanced usage Payload generators

Raffael Herrmann edited this page May 22, 2024 · 32 revisions
  1. Introduction to the "Payload Generator"
  2. Overview of the different payload types
  3. Usage of the payload generators
    3.1 BezahlCode
    3.2 Crypto Payment Address (e.g. Bitcoin, Litecoin, ...)
    3.3 Bookmark
    3.4 Calendar events (iCal/vEvent)
    3.5 ContactData (MeCard/vCard)
    3.6 Geolocation
    3.7 Girocode
    3.8 Mail
    3.9 MMS
    3.10 Monero address/payment
    3.11 One-Time-Password
    3.12 Phonenumber
    3.13 Russia Payment Order
    3.14 Shadowsocks configuration
    3.15 Skype call
    3.16 Slovenian QR Code for UPN QR Forms
    3.17 SMS
    3.18 SwissQrCode (ISO-20022)
    3.19 URL
    3.20 WhatsAppMessage
    3.21 WiFi
  4. Development of own payload types

1. Introduction to the "Payload Generator"

The payload generator is one of the things, which make the QRCoder unique. It's a class which helps to generate special payloads (=the text encoded in QR codes) that will start different actions on the device which scans the QR code.

Indeed a QR code can only encode a string (of text), but if this string has a special format, most* QR code scanners will perform a predefined action.

To help you to create these special formatted payload strings, we implemented the payload generators. These are easy-to-use classes, which check your data for invalid inputs and "automagically" create the fitting payload strings for you.

Info:Keep in mind, that all payload types stand and fall with the commitment between QR encoders and QR scanner apps. Special payload types aren't defined in the QR code standard (ISO/IEC 18004). Most of the QR code scanner apps are able to interpret the payload types described on this page. But in a real world application you should test your QR codes against the scanners your users will use.


2. Overview of the different payload types

Right now there are 19 different payload generators. To get a quick overview, have a look at the following table.

(Class-)NameWhat does it do, when scanned?Specification
BezahlCodeOpens the banking app for bank transfers, debits and banker's order. It's common in German-speaking countries and competes with the more common GiroCode.Bezahlcode specification
Bitcoin(LikeCryptoCurrency)AddressStarts crypto currency app for transfers.BIP 0021
BookmarkSaves a bookmark to the default webbrowser.NTTdocomo MEBKM
CalendarEventAdds an event to the user's calendar. Supports iCal and vEvent format.RFC 5545
ContactDataAdds a contact to the user's address book. Supports MeCard, vCard 2.1, vCard 3.0 and vCard 4.0 format.NTTdocomo MeCard, RFC 2425 (vCard 2.1), RFC 2426 (vCard 3.0), RFC 6350 (vCard 4.0)
GeolocationOpens the maps app and shows the given location or opens Google Maps in browser.RFC 5870
GirocodeOpens the banking app for bank transfers. It's common in the European region and competes with the less common BezahlCode.EPC069-12
MailOpens the default email app and composes a new message. Supports mailto:, MATMSG: and smtp: format.RFCRFC 6068, NTTdocomo MATMSG, smtp URI scheme
MMSOpens the standard messaging app and composes a new MMS. Either in mmsto: or in mms: format.RFC draft (mmsto), Data Services: Whitepaper (mms)
MoneroTransactionOpens the Monero wallet with transaction details.Monero URI scheme
OneTimePasswordEncoded secret keys. May be used in combination with Google Authenticator for example.Key URI Format
PhoneNumberOpens the phone's dialer app with given number.RFC 3966
ShadowSocksConfigOpens ShadowSocks app with given configuration.ShadowSocks URI scheme
SkypeCallOpens Skype app and calls given contact.Skype URI API reference
SlovenianUpnQrUsed for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order).Technical description, Advice for programmers
SMSOpen SMS app and composes new message. Supports sms:, sms: (for iOS) and SMSTO: format.RFC 5724 (sms), sms URI for iOS, SMSTO (not common)
SwissQrCodeOpens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein).ISO 20022
UrlOpens the given URL in default webbrowser.RFC 3986
WhatsAppMessageOpen whatsapp, lets you choose a contact and composes a new message with given text.WhatsApp URL Scheme
WiFiWhen scanned, the scanning device can login to the given WiFi without typing the credentials.Short description

3. Usage of the payload generators

3.1 BezahlCode

Classname/Classfile: BezahlCode / PayloadGenerator.cs

When to use?

Use it for banking (inlcuding bank transfers, debits, bank contacts and banker's order). It's used in German-speaking countries and competes with the more common GiroCode.

How to use it - simple way

The following code generates a payload for a simple SEPA payment to Wikimedia.

BezahlCodegenerator=newBezahlCode(BezahlCode.AuthorityType.singlepaymentsepa,"Wikimedia",iban:"DE33100205000001194700",bic:"BFSWDE33BER",amount:25.00m);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are four overloads:

Overload 1
Description: Creates a payload for SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 2
Description: Creates a payload for non SEPA-based payments and transfers

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)

Overload 3
Description: Creates a payload for exchange of bank/payment contact data

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstring""Bank account (Kontonummer)
bncstring""Bank institute (Bankleitzahl)
ibanstring""IBAN
bicstring""BIC
reasonstring""Reason (Verwendungszweck)

Overload 4
Description: Generic constructor used by overload 1 and 2.

Parameter nameTypeDefaultDescription
authorityAuthorityTypeType of the bank transfer
namestringName of the receiver (Empfänger)
accountstringBank account (Kontonummer)
bncstringBank institute (Bankleitzahl)
ibanstringIBAN
bicstringBIC
amountdecimalAmount (Betrag)
periodicTimeunitstring""Unit of intervall for payment ('M' = monthly, 'W' = weekly)
periodicTimeunitRotationint0Intervall for payment. This value is combined with 'periodicTimeunit'
periodicFirstExecutionDateDateTime?nullDate of first periodic execution
periodicLastExecutionDateDateTime?nullDate of last periodic execution
creditorIdstring""Creditor id (Gläubiger ID)
mandateIdstring""Manadate id (Mandatsreferenz)
dateOfSignatureDateTime?nullSignature date (Erteilungsdatum des Mandats)
reasonstring""Reason (Verwendungszweck)
postingKeyint0Transfer Key (Textschlüssel, z.B. Spendenzahlung = 69)
sepaReferencestring""SEPA reference (SEPA-Referenz)
currencyCurrencyCurrency.EURCurrency (Währung)
executionDateDateTime?nullExecution date (Ausführungsdatum)
internalModeint0Only used for internal state handdling

Good to know

BezahlCode is a format which competes with the GiroCode. Both can be used for banking purposes but GiroCode is a little more common and newer. Nevertheless BezahlCode has some more features like periodic transfer and debits. So before choose one of both, check which one fits your needs and which one is better supported by your users and their QR code scanner apps.


3.2 (Bitcoin like) Crypto Currency Payment Address

Classname/Classfile: BitcoinAddress|BitcoinCashAddress|LitecoinAddress / PayloadGenerator.cs

When to use?

Use this payload to share Bitcoin/Bitcoin Cash/Litecoin addresses or initiate payments in one of those currencies.

How to use it - simple way

BitcoinAddressgenerator=newPayloadGenerator.BitcoinAddress("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W",1.5d);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a Bitcoin address with or without amount to transfer and message.

Parameter nameTypeDefaultDescription
addressstringBitcoin address of the payment receiver
amountdouble?Amount of Bitcoins to transfer
labelstringnullReference label
messagestringnullReferece text aka message

Good to know

If you want to share only the crypto currency address without any amount of coins, set the variable amount to null. Replace "Bitcoin" by "BitcoinCash" or "Litecoin" to generate payloads for those currencies.


3.3 Bookmark

Classname/Classfile: Bookmark / PayloadGenerator.cs

When to use?

Use this payload, when you want to place a bookmark in the user's default webbrowser.

How to use it - simple way

Bookmarkgenerator=newBookmark("http://code-bude.net","Blog of QRCoder's father");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a bookmark payload including the bookmark title.

Parameter nameTypeDefaultDescription
urlstringUrl of the bookmark
titlestringTitle of the bookmark

Good to know

n/a


3.4 Calendar events (iCal/vEvent)

Classname/Classfile: CalendarEvent / PayloadGenerator.cs

When to use?

Use this payload to place an event to the user's calendar application.

How to use it - simple way

CalendarEventgenerator=newCalendarEvent("Birthday party","Join QRCoder's fourth birthday!","51.26118,6.6717",newDateTime(2017,10,13),newDateTime(2017,10,13),true);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeStart time of the event
endDateTimeEnd time of the event
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Overload 2
Description: Creates an calendar event.

Parameter nameTypeDefaultDescription
subjectstringSubject/title of the calender event
descriptionstringDescription of the event
locationstringLocation (lat:long or address) of the event
startDateTimeOffsetStart time of the event incl. offset in relation to UTC
endDateTimeOffsetEnd time of the event incl. offset in relation to UTC
allDayEventboolIs it a full day event?
encodingEventEncodingEventEncoding.UniversalType of encoding (universal or iCal)

Good to know

The parameters description and location are optional. They can be set to null or string.Empty. If you want to place an event to Apple users you should use iCal instead of Universal as encoding.


3.5 ContactData (MeCard/vCard)

Classname/Classfile: ContactData / PayloadGenerator.cs

When to use?

Use it, when you want to share contact data/business cards. A QR code with this payload type will add the contact data to the user's address book.

How to use it - simple way

ContactDatagenerator=newContactData(ContactData.ContactOutputType.VCard3,"John","Doe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates contact data payload in different formats.

Parameter nameTypeDefaultDescription
outputTypeContactOutputTypePayload output type
firstnamestringThe firstname
lastnamestringThe lastname
nicknamestringnullThe displayname
phonestringnullNormal phone number
mobilePhonestringnullMobile phone
workPhonestringnullOffice phone number
emailstringnullE-Mail address
birthdayDateTime?nullBirthday
websitestringnullWebsite / Homepage
streetstringnullStreet
houseNumberstringnullHousenumber
citystringnullCity
zipCodestringnullZip code
countrystringnullCountry
notestringnullMemo text / notes
stateRegionstringnullState / Region
addressOrderAddressOrderAddressOrder.Defaultenum to define address order (see below)
orgstringnullOrganization/Company
orgTitlestringnullOrganization/Company title

Good to know

Via the parameter outputType you can choose between different formats. Supported formats are: vCard 2.1, vCard 3.0, vCard 4.0 and MeCard. Choose the format which fits your needs. Right now vCard 3.0 is the most used format.

The addressOrderenum specifies in which format the address is rendered. The two options are:

  • Default
    The address format used in European countries and others.
    Sample

    John Doe
    Königsallee 1
    40210 Düsseldorf
    Germany

  • Reversed
    The address format used in North America and others.
    Sample

    John Doe
    123 Fake St.
    Cleveland, OH, 12345
    USA


3.6 Geolocation

Classname/Classfile: Geolocation / PayloadGenerator.cs

When to use?

Use this payload type when you want to share a location. You can choose between the geo-format and Google Maps links.

How to use it - simple way

Geolocationgenerator=newGeolocation("51.26118","6.6717");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: The payload encodes a (geo-)location by its coordinates.

Parameter nameTypeDefaultDescription
latitudestringLatitude with . as splitter
longitudestringLongitude with . as splitter
encodingGeolocationEncodingGeolocationEncoding.GEOEncoding type - GEO or GoogleMaps

Good to know

If you use the geo-format the QR scanner app must support this tag. Most scanners do so. But if you want to be 100% on the safe side, choose Google Maps format because this generates a Google Maps (web-)link which can be interpreted by nearly any QR code scanner.


3.7 Girocode

Classname/Classfile: Girocode / PayloadGenerator.cs

When to use?

Use this payload type if you want to share payment contact information and/or bank transfer data. The Girocode is an European standard and supports SEPA payments.

How to use it - simple way

varpayload=newGirocode("DE33100205000001194700","BFSWDE33BER","Wikimedia",1337.99m);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates the Girocode payload with different options.

Parameter nameTypeDefaultDescription
ibanstringAccount number of the Beneficiary. Only IBAN is allowed.
bicstringBIC of the Beneficiary Bank.
namestringName of the Beneficiary.
amountdecimalAmount of the Credit Transfer in Euro. (Amount must be more than 0.01 and less than 999999999.99)
remittanceInformationstring""Remittance Information (Purpose-/reference text). (optional)
typeOfRemittanceTypeOfRemittanceTypeOfRemittance. UnstructuredType of remittance information. Either structured (e.g. ISO 11649 RF Creditor Reference) and max. 35 chars or unstructured and max. 140 chars.
purposeOfCreditTransferstring""Purpose of the Credit Transfer (optional)
messageToGirocodeUserstring""Beneficiary to originator information. (optional)
versionGirocodeVersionGirocodeVersion. Version1Girocode version. Either 001 or 002. Default: 001.
encodingGirocodeEncodingGirocodeEncoding. ISO_8859_1Encoding of the Girocode payload. Default: ISO-8859-1

Good to know

Important: As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().

Girocode competes (atleast for German-speaking countries) with the Bezahlcode. Even if Girocode has less features, it is more common than Bezahlcode. So choose the right payload type in respect of your users and the features you want to use.


3.8 Mail

Classname/Classfile: Mail / PayloadGenerator.cs

When to use?

Use it when you want to prepare/compose an email. Once scanned the code opens the default mail client with the given information like receiver, subject and message.

How to use it - simple way

Mailgenerator=newMail("john@doe.com","Look at this!","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is one overload:

Overload 1
Description: Creates a new mail with optional subject and body/message.

Parameter nameTypeDefaultDescription
mailReceiverstringnullReceiver's email address
subjectstringnullSubject line of the email
messagestringnullMessage content of the email
encodingMailEncodingMailEncoding.MAILTOPayload encoding type. Choose dependent on your QR Code scanner app.

Good to know

n/a


3.9 MMS

Classname/Classfile: MMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a MMS (message). You can choose if you want to prepare the message or just let the QR code open the messaging app with the correct phonenumber.

How to use it - simple way

MMSgenerator=newMMS("+491701234567","Hi John, have a look at this QRCoder library!");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new MMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingMMSEncodingMMSEncoding.MMSEncoding type

Overload 2
Description: (Pre-)composes a new MMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the MMS
encodingMMSEncodingMMSEncoding.MMSEncoding type

Good to know

This payload type supports (as some of the other payload types, too) different output formats. In most cases/regions you should use the MMSEncoding.MMS-type.


3.10 Monero address/payment

Classname/Classfile: MoneroTransaction / PayloadGenerator.cs

When to use?

This payload opens the user's Monero client/app and prefills its dialog with the given data. Either you pass only the Monero address or you add complete payment/transaction details.

How to use it - simple way

MoneroTransactiongenerator=newMoneroTransaction("46BeWrHpwXmHDpDEUmZBWZfoQpdc6HaERCNmx1pEYL2rAcuwufPN9rXHHtyUA4QVy66qeFQkn6sfK8aHYjA3jk3o1Bv16em");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a Monero payload.

Parameter nameTypeDefaultDescription
addressstringReceiver's monero address
txAmountfloat?nullAmount to transfer
txPaymentIdstringnullPayment id
recipientNamestringnullReceipient's name
txDescriptionstringnullReference text / payment description

Good to know

n/a


3.11 One-Time-Password

Classname/Classfile: OneTimePassword / PayloadGenerator.cs

When to use?

This payload generates a one-time-password QR code which is used for credential-exchange and authentification. You may use it in combination with the Google Authenticator.

How to use it - simple way

OneTimePasswordgenerator=newOneTimePassword(){Secret="pwq6 5q55",Issuer="Google",Label="test@google.com",};stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 0 special overloads. As can be seen in the example above these generator takes it values via properties.

Property nameTypeDefaultDescription
TypeOneTimePassword AuthTypeOneTimePasswordAuth Type.TOTPType of the one-time-password. Either TOTP or HOTP
AlgorithmOoneTimePassword AuthAlgorithmOoneTimePasswordAuth Algorithm.SHA1Algorith of the one-time-password. Either SHA1, SHA256 or SHA512
IssuerstringThe issuer's name
SecretstringThe Base32 encoded secret key
LabelstringThe label
Digitsint6Number of digits
Counterint?nullShall a counter be used?
Periodint?30Valid period

Good to know

The payload generator builds the correct payload for you, but it can't/doesn't calculate the TOTP/HOTP secret for you.


3.12 Phonenumber

Classname/Classfile: PhoneNumber / PayloadGenerator.cs

When to use?

Use it, when you wan't to share a phonenumber or when you want to use the QR code as CTA (call-to-action). Once scanned, the code opens the dialer app on the phone.

How to use it - simple way

PhoneNumbergenerator=newPhoneNumber("+491701234567");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a phone call payload.

Parameter nameTypeDefaultDescription
numberstringPhonenumber of the receiver

Good to know

There is no right or wrong formatting of the given phonenumber. Type the number in this way, you would type it into your phone's dialer.


3.13 RussiaPaymentOrder

Classname/Classfile: RussiaPaymentOrder / PayloadGenerator.cs

When to use?

Use it to generate QR codes for payments in Russia that are compliant to the standard ГОСТ Р 56042-2014.

How to use it - simple way

varaccount="40702810138250123017";varbic="044525225";varbankName="ОАО \"БАНК\"";varname="ООО «Три кита»";varcorrespAcc="30101810965770000413";vargenerator=newPayloadGenerator.RussiaPaymentOrder(name,account,bankName,bic,correspAcc);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(3);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a RussiaPaymentOrder configuration QR code payload.

Parameter nameTypeDefaultDescription
namestringName of the payee (Наименование получателя платежа)
personalAccstringBeneficiary account number (Номер счета получателя платежа)
bankNamestringName of the beneficiary's bank (Наименование банка получателя платежа)
BICstringBIC (БИК)
correspAccstringnullBox number / account payee's bank (Номер кор./сч. банка получателя платежа)
optionalFieldsOptionalFieldsnullOptional additional fields/information
characterSetCharacterSetsCharacterSets.utf_8Encoding of the payload string

Good to know

  • If CharacterSets was set to windows-1251 or koi8-r you should use ToBytes() instead of ToString() and pass the byte-array directly to CreateQrCode()!
  • The maximum length of a RussiaPaymentOrder is 300 byte as defined by the offical standard. Thus it isn't possible to use all additional fields at the same time.

3.14 Shadowsocks configuration

Classname/Classfile: ShadowSocksConfig / PayloadGenerator.cs

When to use?

Use it to share ShadowSocks (Proxy) configurations. When scanned, the QR scanner app should start the ShadowSocks with the given configuration.

How to use it - simple way

ShadowSocksConfiggenerator=newShadowSocksConfig("45.78.47.87",443,"laozhang",ShadowSocksConfig.Method.Aes256Cb);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a ShadowSocks configuration QR code payload.

Parameter nameTypeDefaultDescription
hostnamestringHostname of the ShadowSocks proxy
portintPort of the ShadowSocks proxy
passwordstringPassword of the SS proxy
methodMethodEncryption type
tagstringnullOptional tag line

Good to know

The value of port must be in the range within 1 and 65535. The tag parameter is optional.


3.15 Skype call

Classname/Classfile: SkypeCall / PayloadGenerator.cs

When to use?

Use it when you want to initiate Skype calls. When scanned, the QR scanner app opens skype and calls the user given to the payload generator.

How to use it - simple way

SkypeCallgenerator=newSkypeCall("johndoe");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Creates a skype call action payload.

Parameter nameTypeDefaultDescription
skypeUsernamestringSkype username which will be called

Good to know

n/a


3.16 SlovenianUpnQr

Classname/Classfile: SlovenianUpnQr / PayloadGenerator.cs

When to use?

Used for creation of Slovenian QR Code for UPN QR Forms (UPN = Univerzalni plačilni nalog - Universal Payment Order)

How to use it - simple way

varpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,recipientSiModel,recipientSiReference,code);//or if you need requested date of debitor’s payment (payment deadline) includedvarpayload=newPayloadGenerator.SlovenianUpnQr(payerName,payerAddress,payerPlace,recipientName,recipientAddress,recipientPlace,recipientIban,description,amount,deadline,recipientSiModel,recipientSiReference,code);QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);BitmapqrCodeImage=qrCode.GetGraphic(5);qrCodeImage.Save(@"GeneratedQRCode.bmp");

Parameter table

Parameter nameTypeMax LengthDefaultDescription
payerNamestring33Debitor (payer) name
payerAddressstring33Debitor (payer) address (Street name and house number)
payerPlacestring33Debitor (payer) place (Postal code and name)
recipientNamestring33Creditor (payee) name
recipientAddressstring33Creditor (payee) address (Street name and house number)
recipientPlacestring33Creditor (payee) place (Postal code and name)
recipientIbanstring34Creditor's IBAN
descriptionstring42Description/Comment
amountdoubleAmount (in EUR)
deadlineDateTime?Requested date of debitor's payment
recipientSiModelstring4SI99SI model
recipientSiReferencestring22SI reference
codestring4OTHRPurpose of Payment Code

Good to know

Important: As per official specification Slovenian UPN QR codes have to be generated with ECC-Level M (15%), ECI Mode set to ISO8859-2, Byte mode and QR Version of 15. If you pass the Payload-class itself to the QRCoder (as shown in the last example) then you don't have to set this parameters, since the Payload-class does this automatically.


3.17 SMS

Classname/Classfile: SMS / PayloadGenerator.cs

When to use?

Use it when you want to compose a SMS (message). You can choose if you want to create the message including text or just let the QR code open the messaging app with the given phonenumber.

How to use it - simple way

SMSgenerator=newSMS("+491701234567","Hi John, do you remember SMS?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new SMS for the given contact.

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
encodingSMSEncodingSMSEncoding.SMSEncoding type

Overload 2
Description: (Pre-)composes a new SMS for the given contact with the given message (=subject).

Parameter nameTypeDefaultDescription
numberstringReceiver phone number
subjectstringText of the SMS
encodingSMSEncodingSMSEncoding.SMSEncoding type

Good to know

This payload supports different output formats. In most cases/regions you should use the SMSEncoding.SMS-type, which should work with the most scanner apps.


3.18 SwissQrCode (ISO-20022)

Classname/Classfile: SwissQRCode / PayloadGenerator.cs

When to use?

Opens a banking app for bank transfer or donations. Mostly common in Switzerland. Is part of the "QR-Rechnung" (former Einzahlungsschein). Note: Take care of the advices from the "Good to know" section.

How to use it - simple way

SwissQrCode.ContactcontactGeneral=SwissQrCode.Contact.WithStructuredAddress("John Doe","3003","Bern","CH","Parlamentsgebäude","1");SwissQrCode.Ibaniban=newSwissQrCode.Iban("CH2609000000857666015",PayloadGenerator.SwissQrCode.Iban.IbanType.QrIban);SwissQrCode.Referencereference=newSwissQrCode.Reference(SwissQrCode.Reference.ReferenceType.QRR,"990005000000000320071012303",SwissQrCode.Reference.ReferenceTextType.QrReference);SwissQrCode.AdditionalInformationadditionalInformation=newSwissQrCode.AdditionalInformation("This is my unstructured message.","Some bill information here...");SwissQrCode.Currencycurrency=SwissQrCode.Currency.CHF;decimalamount=100.25m;SwissQrCodepayload=newSwissQrCode(iban,currency,contactGeneral,additionalInformation,reference,null,amount,null,null);QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20,Color.Black,Color.White,(Bitmap)Bitmap.FromFile(Application.StartupPath+"\\CH-Kreuz_7mm.png"),14,1);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a new Swiss Qr code.

Parameter nameTypeDefaultDescription
ibanIbanIBAN object
currencyCurrencyCurrency (either EUR or CHF)
creditorContactCreditor (payee) information
referenceReferenceReference information
additionalInformationAdditionalInformationnullAdditional information texts
debitorContactnullDebitor (payer) information
amountdecimal?nullAmount
requestedDateOfPaymentDateTime?nullObsoleteRequested date of debitor's payment
ultimateCreditorContactnullUltimate creditor information (use only in consultation with your bank!)
alternativeProcedure1stringnullOptional command for alternative processing mode - line 1
alternativeProcedure2stringnullOptional command for alternative processing mode - line 2

Good to know

  • Important: As per official specification Swiss QR codes have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().
  • Important: As per official specification a Swiss cross logo (can be downloaded here) has to be drawn on the code with a size of ~14%. (Per spec the Swiss cross has to be 7mm per side and the Swiss Qr code should be printed with 46mm without quiet zones or 49,2mm per side with quietzones. So we get 7/(49,2/100) = 14% icon size.)

3.19 URL

Classname/Classfile: Url / PayloadGenerator.cs

When to use?

Use it to share links/websites.

How to use it - simple way

Urlgenerator=newUrl("https://github.com/codebude/QRCoder/");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates a link payload.

Parameter nameTypeDefaultDescription
urlstringLink url target

Good to know

If you a domain (without http:// or https://) is given, the payload generater prefixes the given url with http://.


3.20 WhatsAppMessage

Classname/Classfile: WhatsAppMessage / PayloadGenerator.cs

When to use?

Use it to share your WhatApp pre-composed WhatsAppMessages. Once scanned, the QR code opens a WhatsApp chat with the given message.

How to use it - simple way

WhatsAppMessagegenerator=newWhatsAppMessage("Hi John, what do you think about QR codes?");stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There are 2 overloads:

Overload 1
Description: Generates a new WhatsApp message.

Parameter nameTypeDefaultDescription
messagestringThe message text

Overload 2
Description: Generates a new WhatsApp message towards a given contact.

Parameter nameTypeDefaultDescription
numberstringRecipient/contact number
messagestringThe message text

Good to know

-/-


3.21 WiFi

Classname/Classfile: WiFi / PayloadGenerator.cs

When to use?

Use it when you want to share WiFi credentials. Good for meetings, house partys and conventions.

How to use it - simple way

WiFigenerator=newWiFi("My-WiFis-Name","s3cr3t-p4ssw0rd",WiFi.Authentication.WPA);stringpayload=generator.ToString();QRCodeGeneratorqrGenerator=newQRCodeGenerator();QRCodeDataqrCodeData=qrGenerator.CreateQrCode(payload,QRCodeGenerator.ECCLevel.Q);QRCodeqrCode=newQRCode(qrCodeData);varqrCodeAsBitmap=qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Overload 1
Description: Generates WiFi login credentials.

Parameter nameTypeDefaultDescription
ssidstringSSID of the WiFi network
passwordstringPassword of the WiFi network
authenticationModeAuthenticationAuthentification mode (WEP, WPA, WPA2)
isHiddenSSIDboolfalseSet flag to true, if the WiFi network hides its SSID
escapeHexStringsbooltrueSet flag to false, if SSID/password shouldn't be escaped, even if passed as HEX string

Good to know

  • Don't get confused when choosing authenticationMode-parameter. The value WiFi.Authentication.WPA also includes not only WPA but also WPA2!
  • For widest compatibility you may set escapeHexStrings to false, because if SSID/password are provided in HEX style ([A-F0-9] and will be escaped, the QR code may become unreadable by Apple devices. More info: )

4. Development of own payload types

Implementing your own, custom payload generator is quite easy. Simply create a new class for your custom payload and implement the QRCoder.PayloadGenerator.Payload-interface. The only method you have to implement/override is the ToString()-method.

publicclassHelloWorldPayload:Payload{privatestring_name;publicHelloWorldPayload(stringname){_name=name;}publicoverridestringToString(){return$"Hello {_name}";}}

If you have written a cool generator, feel free to send it in as PullRequest.

Clone this wiki locally