DEV Community

Ujjwal Dubey
Ujjwal Dubey

Posted on

A Human-Check Queue for UPI Payment Screenshots in WhatsApp Order Flows

In a lot of Indian small businesses, "payment received" means a customer sent a screenshot on WhatsApp. That screenshot is the most tempting thing to automate and the most dangerous.

Here is the pattern I recommend to anyone building, or hiring an AI automation agency India merchants use for WhatsApp orders to build, payment handling: the model may read and suggest; only a person may mark paid.

Why not let the model decide

Screenshots can be edited, reused or sent for the wrong order. A model reading the image can extract the amount and reference text quite well, but it cannot see your bank account. "Looks paid" is not "is paid".

The queue

from dataclasses import dataclass, field
from datetime import datetime

@dataclass
class PaymentClaim:
    order_ref: str
    wa_phone: str
    image_id: str
    extracted_ref: str | None = None
    extracted_amount: str | None = None
    status: str = 'pending_review'   # pending_review | matched | rejected
    reviewer: str | None = None
    created: datetime = field(default_factory=datetime.utcnow)

def on_screenshot(order_ref, wa_phone, image_id, extract):
    claim = PaymentClaim(order_ref, wa_phone, image_id)
    claim.extracted_ref, claim.extracted_amount = extract(image_id)  # model suggestion only
    return claim  # goes to a review list, never straight to 'paid'

def approve(claim, reviewer, bank_ref_seen: str):
    if bank_ref_seen.strip() != (claim.extracted_ref or '').strip():
        claim.status = 'rejected'
    else:
        claim.status = 'matched'
    claim.reviewer = reviewer
    return claim
Enter fullscreen mode Exit fullscreen mode

The reviewer checks the bank or payment app, types the reference they actually see, and the system compares. The customer gets "payment confirmed" only after matched.

Small details that matter

  • Acknowledge instantly, confirm later. Reply "Received your screenshot, we will confirm shortly" so the customer is not left waiting in silence.
  • Duplicate detection. If the same extracted reference appears on two orders, flag both.
  • Keep the image. Store the screenshot ID with the claim so disputes can be checked later.
  • Log the reviewer. Every confirmation should have a name on it.

Where this fits

This is one small piece of an order workflow. If you are deciding whether to buy a ready chatbot or build pieces like this, our post on when a ready chatbot is enough and when to build covers the trade-off.

I run NxFlowAI (Mumbai). Code is illustrative; adapt it to your own stack.

Top comments (1)

Collapse
 
officialmailkr profile image
오피셜메일 •

이미지에서 읽은 값과 실제 입금 확인을 분리한 점이 중요하네요. 예시의 approve 단계에는 참조번호뿐 아니라 검토자가 확인한 금액과 주문도 함께 대조하는 절차가 드러나면 좋겠습니다. 같은 참조번호가 두 주문에 걸렸을 때 어느 쪽도 바로 확정하지 않고 보류 상태로 묶는 테스트도 유용하겠어요.