Skip to content
onchain-engineeringstablecoin-payments
Joshua C.

Detecting and Handling Pending USDC Payments Onchain

Stablecoin payments can be delayed or pending. Learn how to detect, surface, and handle pending USDC payments in your onchain product workflows, with real examples.

Detecting and Handling Pending USDC Payments Onchain

Delayed or pending stablecoin payments are a fact of onchain billing, even on fast networks. Customers expect receipts and product access to match payment intent, but block time, network congestion, and wallet UX can create gaps between user action and confirmed settlement. For teams building SaaS, marketplaces or usage metering on Arc, Base, Ethereum or Polygon, handling pending USDC payments is about more than polling a block explorer. It is a product workflow and UX problem as much as an engineering one.

Why Stablecoin Transactions Get Delayed

Most pending USDC payments come down to three causes:

  • Network Congestion: High gas prices or full blocks mean submitted transactions take longer to confirm. On Ethereum, a spike can push confirmation times from seconds to minutes.
  • User Error or Underfunding: Customers may sign a transaction with too low a gas price, or lack enough ETH/MATIC for a fast transfer. The transaction gets stuck in the mempool.
  • Wallet UX or Approval Flows: Some wallets batch or delay sending transactions, especially if a user needs to approve a new contract or set a cap first.

None of these are under a merchant’s control. But every merchant is on the hook for what happens next: does the user get access, do you mark the invoice paid, or do you show a status and wait?

Payment Statuses: Pending, Confirmed, Failed

For any product workflow, the critical distinction is between three states:

  • Pending: The payment is signed and broadcast, but not yet confirmed onchain.
  • Confirmed: The payment is included in a block and visible onchain. Funds have moved from the customer’s wallet to the merchant’s settlement address.
  • Failed: The transaction is dropped or reverted. No funds moved. The invoice remains unpaid.

Surfacing these states in your UI and automating downstream logic is the core of handling payment lags.

Example: SaaS Subscription with Delayed USDC Payment

Suppose you run a SaaS billing workflow on Polygon. A customer goes to pay an invoice for 300 USDC. They sign the transaction and your checkout detects the tx hash. But Polygon is congested, so confirmation takes 4 minutes instead of 10 seconds.

Time Payment Status UI/Workflow Action
T+0s Pending Show spinner, “Payment processing” message
T+30s Pending Offer support link, explain delay
T+4min Confirmed Mark invoice as paid, provision service

If the transaction fails (out of gas, replaced, or dropped):

Time Payment Status UI/Workflow Action
T+4min Failed Show error, allow retry, invoice unpaid

Your product should not provision service or mark the invoice as paid until the payment is confirmed onchain. But you also should not leave the customer in the dark during the pending window.

Detecting Pending USDC Payments Programmatically

Polling for status is the usual pattern. When your front-end or backend receives a tx hash, you check its status. On Arc, Base, Ethereum and Polygon, use a node provider or indexer to watch for confirmations.

A simplified example in TypeScript, using ethers.js:

import { ethers } from 'ethers';

async function pollForConfirmation(txHash: string, provider: ethers.providers.Provider, maxAttempts = 30) {
  let attempts = 0;
  while (attempts < maxAttempts) {
    const receipt = await provider.getTransactionReceipt(txHash);
    if (receipt && receipt.confirmations > 0) {
      return receipt;
    }
    await new Promise(r => setTimeout(r, 5000)); // wait 5 seconds
    attempts++;
  }
  throw new Error('Transaction not confirmed in time');
}

In production, you would: - Surface the pending state to the user - Set a timeout for how long you keep polling (to avoid infinite spinners) - Provide a way to retry or contact support if confirmation does not arrive

Handling Edge Cases: Stuck or Replaced Transactions

Not every pending payment ends in confirmation. Users can:

  • Replace a stuck transaction with a higher gas price (same nonce)
  • Abandon a transaction if they close their wallet or browser
  • Sign but never broadcast the transaction

Your invoice or subscription logic must account for these. If you see a tx hash in the mempool for too long, eventually mark the payment as failed or expired. Do not grant product access until you see an onchain USDC transfer to your address, matching the invoice reference or amount.

What about Partial Payments or Wrong Amounts?

Onchain, what counts is actual settlement. If a customer sends the wrong amount, the invoice remains unpaid. Your system should surface the mismatch and prompt for correction, not attempt to reconcile partial payments automatically unless your business logic supports it.

Best Practices for Surfacing and Handling Payment Lags

  • Show Real Status: Use clear language like “Processing onchain” or “Waiting for confirmation” rather than “Success” until the payment is confirmed.
  • Timeouts and Retries: After a reasonable window (often 5-10 minutes), allow the user to retry payment or contact support. Do not leave them waiting forever.
  • Webhooks and Events: Use webhooks to trigger downstream actions once confirmation is detected. This keeps your product state in sync with actual blockchain settlement.
  • No Premature Access: Never provision services or mark invoices paid before confirmation. Onchain settlement is the source of truth.

How We Handle Pending Payments at Reclack

We built Reclack to keep merchants out of the pending-payment guessing game. Our checkout, hosted links, API and embeds all detect when a USDC payment is pending, and surface that status to both payer and merchant. We poll the chains, Arc, Base, Ethereum, Polygon, for confirmation, and only mark an invoice complete (or a subscription renewed) when the transfer has settled to your address. If a transaction is stuck, our workflows time out and prompt for a retry, without leaving your customer in limbo. For more on our approach, see reclack.com.

onchain-engineeringstablecoin-payments