Abstract picture of QR Code technology

Simple Brilliance.

Many times the most brilliant solutions are the simple ones. Simple and brilliant are exactly what Stellar Ecosystem Proposal (SEP) 0007 is for payments on the Stellar network. It set the standard for providing all the information necessary for making a payment on the Stellar network. Its adoption opened up seamless peer-to-peer payment possibilities with a scan of a universally readable QR code.

Quick SEP overview

Anyone can make a proposal to change Stellar. A proposal to change Stellar comes in one of two forms:

  • A Core Advancement Proposal (CAP) that requires a coding change to the core protocol of the Stellar network; or

  • A Stellar Ecosystem Proposal (SEP) that establishes or changes the standards, protocols, and methods used in the Stellar ecosystem and is built on top of the Stellar network.

Sometimes a SEP will be paired with a CAP, but a SEP by itself does not require any coding changes.  It’s simply a way to formalize a preferred implementation path among developers. A SEP is similar to electronic manufacturers agreeing to use a standardized charging plug so that consumers can charge many different electronic devices with a single charger.

SEPs allow developers to agree on how services using the network should be implemented to allow for maximum interoperability. Often, they do that by specifying two sides of an interaction: one side creates an API that acts in a predictable way; the other consumes it.

How to create a SEP-0007 payment QR Code

Creating a payment QR code readable with any SEP-0007 Stellar wallet is actually quite easy to do, particularly if not using some of the more advanced features described in SEP-0007 itself.

All someone needs to do is follow an assembly formula to create a string of text that SEP-0007 wallets can read. The string of text for a payment >

starts with:

web+stellar:pay:?

followed by a payment parameter and its value:

parameter=value

with each payment parameter separated by a:

&

This is what the resulting string looks like assembled for two payment parameters:

web+stellar:pay?<parameter1>=<value1>&<parameter2>=<value2>

The pattern continues until the text string includes all the payment parameters you want to include.

What’s are payment parameters?

Payment parameters are the details of a payment, such as where to send the payment and the amount of the payment. Aside from where to send the payment, which is required for obvious reasons, all other payment parameters are optional. There are 11 payment parameters defined in the SEP, but the three most frequently used are:

  • destination (required) – The Stellar wallet address where the payment will be sent.

  • amount (optional) – The amount that the destination wallet will receive. If this parameter is not included then the wallet will ask the user to enter the amount to be sent. The use case for leaving this out is to support donations of arbitrary amounts.

  • memo (optional) – An information memo with up to 28 characters (no more than 32 bytes).

Public Node membership example

Public Node has an annual membership that costs 500 XLM. The SEP-0007 payment parameters associated with this membership are:

  • destination=GAVF6ZB7Z7FKCWM5HEY2OV4ENPK3OSSHMFTVR4HHSBFHKW36U3FUH2CB
  • amount=500
  • memo=Public Node Annual

Keep in mind, the memo could have been anything. We chose to use a short description with the context of the purchase for future reference, but there are many right way to use the memo. For example, a business could generate a unique QR code for every payment and use the memo to record the invoice number. Assembling these payment parameters using the SEP-0007 formula creates the following string of text:

Copy to Clipboard

Creating the QR code

A QR code is created by pasting the SEP-0007 string of text into a QR code generator. There are many free options available on the internet, even some that a developer could easily add to a website or point-of-sales system to generate QR codes on the fly.

Our favorite for static QR codes is QR-Code-Generator.com because it provides some fabulous ways to customize the QR code and provide some useful context for its use. For example, we generated this QR code that matches Public Node’s color scheme, displays our logo, and includes some additional information that tells a person the purpose of the QR code – to pay for Public Node’s annual membership.

Public Node annual membership payment QR code

We created this QR code by selecting QR-Code-Generator’s “static” and “text” options.

Stellar payment QR code on retail shirt

Take it to the next level

There are two more payment parameters that are worth discussing in a SEP-0007 payment crash course, particularly with how they function in combination with Stellar’s Path Payment feature. In summary, Stellar’s Path Payment feature allows the payer to pay with any asset they own while the person receiving the payment receives only the asset they want. For example, a person can pay with Stellar lumens (XLM) while the recipient receives USD.

The two payment parameters that allow the recipient to specify the preferred asset are:

  • asset_code (optional) – The asset code that the recipient will receive (defaults to XLM if not present).

  • asset_issuer (optional) – The Stellar address of the asset issuer (defaults to XLM if not present).

The five-cent example

Assembling the following payment parameters results in a payment to Public Node of five cents even when the payer owns no USD.

  • destination=GAVF6ZB7Z7FKCWM5HEY2OV4ENPK3OSSHMFTVR4HHSBFHKW36U3FUH2CB
  • amount=.05
  • asset_code=USD
  • asset_issuer=GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX
  • memo=five-cent example

The asset issuer in this example is AnchorUSD. Public Node’s wallet will need to establish a trustline with AnchorUSD and Public Node will need an AnchorUSD account to withdrawal to cash, but the sender does not need the trustline, nor any USD, for Stellar to automatically find the lowest cost payment path.

Copy to Clipboard

Five cents in five seconds

Again, the five-cent example QR code was created by pasting the SEP-0007 text string above into the static and text option at QR-Code-Generator.com.

If you want to see this feature in action, use a SEP-0007 wallet with Path Payment capability, like the Stellar wallet included with Keybase.io, to scan the QR code below and send a payment from a Stellar wallet without any USD assets. Then explore Public Node’s wallet and watch your 5-cent payment arrive in 5 seconds or less.

Public Node five cent example payment QR code

Oh the possibilities

Near zero cost peer-to-peer payments indifferent between the form of value offered and the form of value accepted. All completed with nothing more than an easily created QR code and a SEP-0007 Stellar wallet.

Anyone interested in paying to ride a zebra?

Zebra in grass field with QR Code for stripes