Recall refunds that admit uncertainty and survive a lost payment response. Demo video ยท Code

The problem

When a product is recalled, a small merchant has to answer the same question for every customer: is this unit one of the affected ones, and if so, has it been refunded exactly once? The evidence is a photo of a label that may be blurred, cropped or from an excluded batch. The payment step can time out after the refund was already created. Guessing on either side costs money or leaves an unsafe product unresolved.

Who it is for

A merchant's support or operations person handling one recall campaign, and the customer checking whether their unit is covered. The prototype models one fictional brand, one approved refund campaign and one order.

What it does

One workspace follows a single case through three steps.

  1. Check label. The customer uploads a label photo. A model proposes the model and batch identifiers with a self-reported confidence. Anything unreadable, conflicting or below the threshold is left blank and the app asks one targeted question instead of guessing. The customer confirms every identifier. Deterministic campaign rules, not the model, decide match, exclusion or needs-information.
  2. Merchant review. The same assessment opens for the merchant with the order facts. A model drafts a short brief; code shows it only if every number, identifier and citation appears in the case records, and otherwise shows a deterministic template and says why. The merchant confirms the remedy conditions and types the exact refund amount. A different amount is refused.
  3. Refund status. The refund goes to the PayPal sandbox. Customer and merchant read the same case, operation and refund.

How AI is used

  • Label reading: image to structured identifiers with explicit uncertainty. Text printed on a label is treated as data, never as instructions.
  • Merchant brief: grounded summary with citations, validated by code or replaced.
  • AI never decides eligibility, never approves and never moves money. Those stay with deterministic code and a person.

How PayPal is used

PayPal REST APIs on the sandbox: OAuth client credentials, Payments v2 capture refund with PayPal-Request-Id idempotency and a custom_id binding, capture, order and dispute reads before approval, refund read-back before a case is called refunded, and webhook signature verification for PAYMENT.CAPTURE.REFUNDED.

What is different

Most refund flows are written for the case where everything is read correctly and every response arrives. RecallRelay is built around the two places that go wrong:

  • Uncertain evidence is a first-class result. An unreadable or conflicting label never becomes eligible. The workspace shows what was uncertain and what was asked.
  • An unknown payment outcome is not a failure and not a success. The operation ID is stored before PayPal is called. If the response is lost, the case stays pending, nothing is retried automatically, and re-checking sends the same operation ID so PayPal returns the existing refund. The demo deliberately discards a real acknowledgement to show this.
  • Events are hints, not truth. A verified webhook settles a case only after PayPal's own read-back matches the stored operation, amount, currency and custom_id. A replayed event changes nothing.

What was measured

  • The unified workspace against the real PayPal sandbox on 12 November 2026: four simulated 40.00 USD refunds on four captures. Each acknowledgement was deliberately discarded, the case stayed pending, and re-checking with the same operation ID recovered it. PayPal lists exactly one refund on each capture. Record.
  • A separate real sandbox webhook exercise on 12 November 2026: one simulated 20.00 USD refund, acknowledgement deliberately lost, two genuine verified webhook deliveries (original and replay), matching provider read-back and customer status. Record.
  • Two real sandbox retry experiments on 9 November 2026: the same request ID returned the same refund both times. Merchant runbook.
  • Label reading through a real model on twelve unseen synthetic labels, with references frozen before the run: 11 of 12 calls returned, 20 of 22 fields agreed and no unaffected unit became eligible. On one unreadable image the model invented identifiers, which is why a person confirms every identifier.
  • Label reading on twelve synthetic development images: 24 of 24 fields agreed with authored references; one internal participant's median completion time was 4.88 s with AI assistance and 8.03 s typed, with two of twelve cases slower with AI. Results and limits.
  • Merchant brief on fourteen invented cases, including four prompt-injection cases: 12 of 14 model drafts passed the checker in the last run; the other two were replaced by the template.
  • Automated checks on 12 November 2026: 173 customer-side, 169 merchant-side, 3 contract and 19 UI tests passed on macOS.

Limits, stated plainly

Prototype scope: synthetic labels, one fictional campaign and order, PayPal sandbox funds, run locally without login. Small evidence base: 24 synthetic labels, 14 invented cases, one internal tester and no merchant pilot, so we make no general accuracy, time-saving or exactly-once claim.

How to test it

Code: https://github.com/RajivRanganath/recallrelay

No account is needed for the default run (Python 3.11):

git clone https://github.com/RajivRanganath/recallrelay.git
cd recallrelay
python3 -m venv evidence/.venv
evidence/.venv/bin/python -m pip install -r evidence/requirements.lock.txt
evidence/.venv/bin/python -B -m evidence.integrated --port 0 --lose-first-refund-response

Open the printed URL and follow Check label, Merchant review, Refund status. This run uses mock label reading, template briefs and fake payments, and still shows the lost-response recovery. Real model calls and PayPal sandbox refunds use the flags in LIVE-WORKSPACE.md with your own sandbox app and model key.

Share this project:

Updates

Submission history