# Fixing "agent dispute evidence uploader attached the wrong order receipts"

## TL;DR

Join evidence to the dispute through the payment id, never through the amount or date. Fetch the order using the disputed payment's id, verify the order total matches the disputed amount, and only then attach. Wrong-order evidence loses disputes that were winnable.

```text
agent dispute evidence uploader attached the wrong order receipts
```

## Steps

1. Change the evidence gatherer to start from the dispute's payment id and fetch that exact payment and order.
   Expected: The evidence packet references the disputed payment id on every document.
2. Add a match check: the order total must equal the disputed amount and the order date must fall within the dispute window.
   Expected: A wrong-order pick fails the check instead of being uploaded.
3. Require the packet to include the receipt, shipping or delivery proof, and the customer communication for that order only.
   Expected: Reviewers see one coherent order story, not mixed documents.
4. Have a human or a second pass review the packet before submission when the dispute value is above your threshold.
   Expected: High-value disputes get a second pair of eyes.

## Prevention

Amount-matching is the trap: two orders for the same amount look identical to a naive matcher. The payment id is the only reliable join key between a dispute, a payment, and an order. Build the uploader around it from the start.

## Detection

Audit submitted evidence: check that every attached receipt's order id traces to the disputed payment id. Watch for disputes lost with the reason "evidence does not match the transaction." Sample recent submissions and verify the join.

## Recovery

If the evidence deadline has not passed, withdraw or supplement the submission with the correct order's evidence. If the deadline passed, log the loss cause, fix the join logic, and tighten the review gate so it cannot recur.

## When this applies

- Dispute evidence referenced a different order number than the disputed payment
- The uploader picked receipts by matching amount or date
- A dispute was lost and the evidence packet mixed two orders

## When it doesn't

- The evidence was for the right order but too thin to win (that is an evidence-quality problem)
- The dispute deadline was missed entirely
- The dispute is fraud-type where no receipt would help

## Compatibility

Stripe API (disputes with payment intent references, evidence submission), Adyen API v68 and later (dispute management), PayPal REST API v2 (disputes with evidence upload). Any provider where disputes link to a payment id.

### chargeback evidence attached receipts from a different order

### dispute uploader matched the wrong order by amount

### evidence packet mixed documents from two orders

## Why it happens

The agent is told "gather evidence for this dispute" and the dispute shows an amount. The agent searches orders by that amount, finds the most recent one, and uploads its receipts. Repeat customers with identical order amounts make this wrong disturbingly often.

## Edge cases

- Partial refunds before the dispute: the disputed amount may be less than the order total; match on payment id, not amount
- Split shipments: gather delivery proof for all shipments tied to the order, not just the first
- Digital goods: server logs and access records count as delivery proof; include timestamps tied to the disputed payment

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_CVlWcmkcWaxTAdPeEDooOg
