buildwithrex Follow
All posts

How the UPI soundbox says "₹50 received" within seconds

Your phone never talks to the shop's soundbox. It keeps one connection open, and the server pushes the payment the moment it's confirmed. Why that beats asking every few seconds.

Payments & fintech · 22 Oct 2026 · 2 min read

You scan the QR code, pay ₹50, and within a second or two the little speaker on the counter says "pachaas rupaye prapt hue". Nobody pressed anything. And your phone never talked to that box: no Bluetooth, no SMS, no sound signal. So who told it?

The path of the money

A UPI payment goes from your app to your bank, through NPCI's switch, to the shop's bank. When the payment is confirmed, the shop's payment provider (the company whose QR and soundbox the shop uses) learns about it on its servers. The box is the last step: the provider's server has to tell it.

Design one: ask again and again

The obvious design is polling. Every few seconds, the box asks the server "koi payment aaya?". It works, but think about it at scale. Almost every answer is "no". With lakhs of boxes asking every five seconds, the server handles a flood of useless requests, each box burns mobile data and power, and the news still reaches the shop up to five seconds late. Android's own documentation warns that polling "can waste network connection and power" when the radio wakes up "only to receive an answer that no new data is available".

Design two: keep the line open

The better design is push. The box has its own SIM card (Paytm's 4G Soundbox, for example, falls back to 2G where 4G isn't available), and it opens one connection to the server and simply keeps it open. Every so often it sends a tiny keep-alive ping, so the mobile network doesn't drop the idle connection. When a payment is confirmed, the server sends a small message down that already-open connection, and the box speaks at once.

Think of a phone call you leave on. The line stays open, someone says "haan, sun raha hoon" now and then, and you speak only when there's news. (Unlike a real call, an idle network connection costs almost nothing.)

Protocols such as MQTT were designed for exactly this: small devices on unreliable mobile networks. The device subscribes to its own topic, a broker forwards each message to it, and the keep-alive ping is just 2 bytes. The providers don't publicly say which protocol their boxes use, but the design is the same idea.

What a strong answer adds

  • At-least-once delivery, with de-duplication. If an acknowledgement is lost, the message is sent again, so the box remembers transaction IDs and announces each payment once.
  • Reconnect with random backoff. After an outage, lakhs of boxes reconnecting at the same instant would knock the server over again. A random, growing wait spreads them out.
  • A fallback. Messages are queued while a box is offline, and the shop still has the business app and bank SMS.

The answer to give

Polling nahi, push: one open connection per device, keep-alive pings, and the server sends the moment the event happens.

One practical note for shopkeepers: fake payment apps can show a "success" screen, and some even play a fake "received" sound from the customer's phone. Trust your own soundbox, business app or bank SMS, never the customer's screen.

Sources: OASIS MQTT 5.0; Android developers, server-initiated traffic; The Paypers, Paytm 4G Soundbox; PhonePe press, SmartSpeaker; HiveMQ, MQTT QoS.