# Quick Reference: Manual Payment Matching

## 🎯 Purpose
Manually match unmatched M-Pesa payments to borrowers when automatic matching fails.

## 📍 Location
**URL:** `https://branchbusinessadvance.co.ke/payments/callbacks/`

## 🔍 How to Identify Unmatched Payments
Look for: **⚠️ Not matched** in the "Who Paid" column

## ⚡ Quick Steps

### Method 1: From Table
1. Find unmatched payment
2. Click **"👤 Match Payer"** button
3. Search for borrower (type name/ID/phone)
4. Select borrower from dropdown
5. Click **"✓ Match & Process Payment"**

### Method 2: From Details
1. Click **"👁️ View Details"** button
2. Click **"👤 Match to Borrower"** button
3. Follow steps 3-5 above

## ✅ Success Messages

| Message | Meaning |
|---------|---------|
| ✓ Payment successfully matched... Receipt: XXX | Full success - repayment created |
| ⚠️ Payment matched but no repayment created | Matched but no active loan |
| ✕ Payment matched but processing failed | Error during processing |

## 🔧 Troubleshooting

| Problem | Solution |
|---------|----------|
| No repayment created | Check if borrower has active loan |
| Can't find borrower | Verify account is active and role is "borrower" |
| Error during processing | Check error message, verify loan status |

## 📋 What Happens When You Match

1. ✓ Payment linked to borrower
2. ✓ Bill reference updated to borrower's ID
3. ✓ Payment processed automatically
4. ✓ Repayment created (if active loan exists)
5. ✓ Your username logged in processing notes

## 🔒 Security
- Requires staff/admin privileges
- All matches are logged with your username
- Cannot be undone automatically

## 💡 Pro Tips
- Use search box to filter borrowers quickly
- Verify payment amount before matching
- Check borrower profile if no repayment created
- All matches are audited - be careful!

## 📞 Need Help?
See full documentation: `MANUAL_PAYMENT_MATCHING_GUIDE.md`
