A crypto checkout with no backend: verifying a USDT payment from the browser
A crypto checkout with no backend: verifying a USDT payment from the browser Most e-commerce checkouts require a heavy stack: a database to store orders, a server to handle logic, and a way to listen to blockchain even
A crypto checkout with no backend: verifying a USDT payment from the browser
Most e-commerce checkouts require a heavy stack: a database to store orders, a server to handle logic, and a way to listen to blockchain events.
But what if you could build a fully functional service store using only a static site?
In this article, Iβll walk through how the crypto-store handles payments. We aren't using a traditional backend to watch for transaction events. Instead, we use a "balance-delta" methodβverifying a USDT (BEP-20) payment directly from the visitor's browser using a public RPC.
The Architecture: No Backend, No Problem
When a user visits the store to order a service (like an AI code review or a landing page), the site needs to know if they actually sent the money. Usually, this requires a backend to index blockchain events.
Instead, we use a Client-Side Balance Check. Here is the logic:
-
The Baseline: When the user initiates an order, the app performs an
eth_callto get the current USDT balance of the store's wallet. -
The Watchdog (Polling): Once the baseline is set, the browser doesn't just sit idle. It initiates a polling loop. Every 20 seconds, the app sends a new
eth_callusing thebalanceOfselector (0x70a08231) to check the current USDT balance of the store's wallet. - The Verification: The app calculates the difference between the new balance and the baseline. If that difference is greater than or equal to the quoted amountβwith a 0.1% tolerance to account for any minor rounding or precision issuesβthe payment is flagged as "Paid" in the browser.
- The TTL (Time-to-Live): To prevent the app from waiting indefinitely, the check expires after 60 minutes. If the payment isn't detected within this window, the session expires.
The "Honesty" Disclaimer: Why this isn't a perfect automated system
While this method is incredibly efficient for a static site, it isn't without its quirks. Because we are using a "balance-delta" check (looking at how much the total wallet balance increased) rather than looking for a specific transaction hash, there are two things you should know:
- The Concurrent Buyer Risk: If two people pay at the exact same moment, the app might see a single large jump in the wallet balance and attribute it incorrectly. This is a known technical limitation of using a single wallet for multiple simultaneous orders.
- The Human-in-the-Loop: Because of the reason above, the "Paid" status in your browser is a convenience, not a final legal contract. To ensure 100% accuracy, the owner manually verifies every transaction on BscScan before beginning any work.
Delivery & Refunds
Because this is a service-based store (offering things like AI code reviews and landing page builds), the process isn't instant:
- Delivery: Once your payment is confirmed, your service will be delivered via email or Telegram within 24-48 hours.
- Refunds: All sales are final. There are no refunds, so please ensure you are sending USDT on the BNB Smart Chain (BEP-20). Sending USDT on any other network (like Ethereum or Polygon) will result in lost funds.
If you want to see this logic in action, or if you need a resume rebuild, a landing page, or a deep-dive AI code review, head over to the crypto-store.
Disclaimer: This article was written with AI assistance.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.