Connection goes down, business stays up

Introducing Offline Mode

Written by Michael White.

Like a great employee or business partner, sellers should always be able to count on Square. And there’s nothing more important than being able to accept a payment, no matter where you’re selling. That’s why last week we introduced Offline Mode for Square sellers.

Now when a mobile seller temporarily loses a cell connection or the Wi-Fi goes down at a brick-and-mortar business, Offline Mode will save them the headache of lost sales.

Offline Mode allows sellers to continue ringing up sales and accepting credit card payments while temporarily without an Internet connection. Square simply stores payment information when the card is swiped and saves it until the connection comes back, keeping a seamless experience for both buyer and seller.

When we built Offline Mode, we wanted the experience to feel the same as regular payments, regardless of the technical steps necessary to make the process as secure and reliable as all of our products. Here’s how we did it:

Secure

We designed security and privacy into Offline Mode from the beginning. To ensure that payment data is protected while it’s stored on a seller’s device, we encrypt it with a unique public key that rotates daily. The associated private key never leaves Square’s servers, so the payment data can only be decrypted after it’s uploaded to Square for processing and cleared from the device.

Reliable

The most important job of Offline Mode is to process offline payments (and get them into sellers’ accounts) as quickly as possible.

Whenever unprocessed payments are on the device, we try to upload them in batches to reduce the number of network requests made. When the server acknowledges receipt, the payment’s encrypted data is cleared from the client. Meanwhile, the server takes care of all the payment-processing mechanics, including authorizing, capturing, sending a receipt, and recording the sale in our reporting infrastructure. After that’s done, the payment appears in payment history like any other payment.

Seamless

Once a seller goes into Offline Mode, selling should feel like business as usual. After taking payments in Offline Mode, sellers have 72 hours to reconnect to the Internet so that payments can be processed. Sellers get reminders on their device that they have payments awaiting processing. And for sellers using iOS 7, we use its background fetch API to attempt to upload payments accepted offline even when the app isn’t running.

And that’s it. We’re in the business of making selling simple. Offline Mode is just the next step in giving sellers the tools they need to make sales and grow their business.

Happy selling, wherever it is you may be. Michael White (@mwwhite) | Twitter The latest Tweets from Michael White (@mwwhite). Engineering Manager at @Square, recovering iOS Engineertwitter.com

Table Of Contents