Background: STACK has partnered with STK to provide a cryptocurrency wallet inside the existing STACK app.

STK lets you make instant payments at points of sale directly from your cryptocurrency wallet. Now you can add your cryptocurrency wallet alongside your other currency wallets in STACK. When you tap to pay through the STACK app, you can make purchases at any retail location that supports credit or debit cards. STK opens a bridge between the Ethereum blockchain and traditional credit card payment rails.

Almost a decade after the introduction of cryptocurrencies, and despite their promise of immense profit, none of the established payment providers have rolled out a convenient way to pay at stores or online with Bitcoin or Ether. In this article I’m going to explain the challenges of creating a cryptocurrency payment protocol at point of sale, and how we resolved them.

Traditional payment rails

Most of the world’s retail transactions (shopping), as well as banking go through a handful of core payment rails. The best known of these rails are run by major credit card companies. They enable banks and other financial institutions to transmit money to each other, securely and reliably.

At STK we focused on consumer-to-retail payments, like those you make at grocery stores, convenience stores, restaurants and other retail locations.

On the current credit card rails, payments from a shoppers to merchants have two stages:

Validation. When a shopper pays at a point of sale terminal, the terminal first checks with the paying institution (the shopper’s personal bank) to see if the payment should be allowed. The bank is responsible for preventing fraudulent transactions. It makes sure there is enough money to cover the purchase, and that the shopper has not already spent his/her money elsewhere. The paying institution sends its response, to either an accept or reject, back through the same rails. Settlement: Even after the transaction at point of sale is complete and the shopper has left the store with the purchase, no money has changed hands. The shopper’s bank has promised to pay the merchant, but the actual payment, called a settlement, happens at a later date. At settlement, the institutions involved reconcile and pay their debts to each other.

The terminal at which you tap to pay is a convenient tool for merchants to check shoppers’ ability to pay, and to obtain their promise to do so. Eventually, these payments are deposited into the merchant’s bank account.

Integrating crypto wallets

Where could cryptocurrency wallets (aka. crypto-wallets) fit into this network? Crypto-wallets store currency in a similar way to banks. In the ideal case, your crypto-wallet, or perhaps the blockchain itself, could participate in this payment network.

The rails providers set criteria for participation in the network. In order to participate as a member a candidate service must satisfy these.

Payment certainty: The service must be able to guarantee a payment that it has promised. When a traditional bank validates a payment, it locks the necessary funds inside the bank account to prevent the account holder from spending the money elsewhere. If a provider promises to pay, but then reneges on that promise, the system may become dangerously unreliable. Fast: The payment guarantee above must be given in near-real-time speed, usually between 0.3 and 1 second.

Crypto-wallets, and blockchains in general, can’t satisfy either of these criteria. Although blockchains can store records reliably and consistently in the long term, early on any transaction is just a pinky-swear. A transaction done through the blockchain may be rejected minutes or sometimes hours after the fact. When this happens, it may be too late for the merchant to get their goods back.

Because of their conflicting design goals, blockchains seem unable to safely supply the instant confirmation that traditional payment rails demand. We need to find a way to reconcile the two.

Possible solutions

1. A dedicated crypto rail

Credit card companies have spent billions of dollars over a span of decades to create a comprehensive network of hardware and software systems that enable global payments. To create a new one from scratch would require a titanic effort.

To reach merchants at their places of business, the current payment network also provide easy-to-use point of sale terminals that plug into their rails. For merchants to adopt a new rail would take years of outreach as well as training. Some companies, like Coinbase and Bitpay, are trying to achieve this through specialized mobile apps. These apps are a good first step, but even they lack the instantaneous payment guarantees that many retail merchants need.

For cryptocurrencies to reach a mainstream audience quickly, a better approach would be to harness the existing rails.

2. Crypto banks

Another way to satisfy the required payment guarantee would be to create a crypto-bank. This institution would hold the private keys to individuals’ crypto wallets. By doing so, they could then guarantee payments and prevent fraud, i.e. double spending.

This solution is attractive in its simplicity. It has a few shortcomings, however. The crypto-bank would completely control their shoppers’ money. This goes against one fundamental design goal of blockchains: autonomy. The new crypto-bank would also expose a security risk. As demonstrated by centralized exchanges like Mt Gox, holding all wallet keys in one place is like placing all your golden eggs in one, temptingly hackable, basket.

STK: A bridge

STK resolves the above problems by acting as a middleman between the existing payment rails and shoppers’ private crypto wallets. STK provides access to a payment channel between a crypto wallet and a 3rd party liquidity provider. This liquidity provider holds a reserve of local currency, and all purchases at point of sale are paid out of this reserve. Initially, the liquidity provider will be STACK.

Payment channels

There’s still a missing piece to this equation: the liquidity provider is paying out of pocket, so it needs a guarantee that it will get paid the appropriate cryptocurrency. Otherwise it will be stuck “holding the bag” on the purchase. It seems we’ve only moved the problem one step back, from the payment rail to the liquidity provider.

Enter payment channels. Payment channels are an exciting step forward in scaling up the Ethereum blockchain. You can find a great summary of how they work here. Payment channels are used to guarantee transactions between any two parties. They provide the missing piece to complete the flow.

At a high level then, when making a purchase using STK,

STK first obtains a signed transaction from the shopper to send the appropriate amount of cryptocurrency from his/her wallet to the liquidity provider’s wallet. The liquidity provider then pays for the purchase from a local currency reserve, through the existing payment rails.

Using payment channels, we can satisfy the requirements of all parties in the transaction. They provide a near-real-time guarantee of payment to the merchant. At the same time they give crypto wallet holders full control over their private keys, including the ability to trade their assets at any time.

Tapping to pay from the app feels like you’re paying the merchant directly from your crypto-wallet. The machinery behind the scenes creates a seamless experience for shoppers.

The payment flow

Here’s a step by step look at how STK makes payments behind the scenes, beginning when a shopper taps to pay at a point of sale. In this example, Alice is trying to buy a sandwich from Starbucks.

Alice taps on the Starbucks point of sale using her mobile app. The point of sale tells the mobile app that the purchase is $3.00, and the currency is dollars. The point of sale then waits to hear if the transaction is approved. The mobile app securely determines how much cryptocurrency would be required to pay for the sandwich. At the current conversion rate, it would be about 0.101 ETH. Through the app, Alice digitally signs a transaction to transfer 0.101 ETH from her crypto-wallet to the liquidity provider. She signs it using her private key, which is stored on her device. The app sends the signed transaction to STK. STK checks that: The amount of cryptocurrency being sent is correct (0.101 ETH), The signed transaction comes from Alice’s crypto wallet, The amount required is available in Alice’s payment channel, If any of the above fails, STK sends a message to the liquidity provider to reject the purchase. Otherwise, STK tells the liquidity provider to approve the transaction. It specifies the wallet, the target merchant (Starbucks), and the amount of the purchase ($3.00). The liquidity provider receives this message, and allows the purchase to go through at the Starbucks point of sale. It sends $3.00 from its own reserve to Starbucks’ bank. The point of sale hears about the transfer, and approves the sale of the sandwich to Alice.

A payment channel is like a bar tab. At some point it needs to be settled, or “closed”. When that happens, each party gets the amount they are due out of the channel.

Benefits of STK

STK brings you the best of both worlds. It combines the ubiquity of existing global payment networks with the secure autonomy of the blockchain. It also has a few additional benefits:

Chargeback. If you pay through STK, you can get a refund for your purchase if the product is not delivered as expected. The money returns to your STACK account through the payment rails; STACK then passes the refund back to your crypto-wallet through STK’s payment channel. Security. Unlike centralized cryptocurrency exchanges, a wallet’s private keys are only stored on the user’s device. Your device provides an additional layer of security against potential theft. System as a service. STK can connect any two parties through a payment channel. STACK is STK’s first partner; others can be added later. Fail-safe. Regardless of what happens to STK’s or STACK’s databases, the funds in the channel are always safe and can be withdrawn by customers.