Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
1391aae
Current working state - v5.0.0 with Flow integration
lalit-swain-cko Oct 5, 2025
27ea6c1
Synced with official v4.9.2: API, SDK, and utility updates
lalit-swain-cko Oct 5, 2025
84c3bc7
Update version to 5.0.0_beta
lalit-swain-cko Oct 6, 2025
10888a4
Fix saved card payment error in Flow integration
lalit-swain-cko Oct 6, 2025
b8ab165
Fix saved card selection and Flow validation issues
lalit-swain-cko Oct 6, 2025
692209f
Fix compatibility with saved cards from previous plugin versions
lalit-swain-cko Oct 6, 2025
c309e0d
Fix duplicate saved cards issue
lalit-swain-cko Oct 6, 2025
1acc98b
Fix migration for MOTO orders (admin-created orders)
lalit-swain-cko Oct 6, 2025
0e4e9d7
Fix Flow integration issues: redirect, webhook, MOTO orders, and save…
lalit-swain-cko Oct 7, 2025
19e79b3
Add comprehensive technical documentation for Flow integration
lalit-swain-cko Oct 7, 2025
ad39cdf
Clean up codebase: Remove debug logging, test scripts, and finalize o…
lalit-swain-cko Oct 7, 2025
743a717
Add final deployment package for easy download
lalit-swain-cko Oct 7, 2025
42d6998
Fix critical webhook error: Add order validation before calling set_t…
lalit-swain-cko Oct 7, 2025
a9992b1
Add enhanced debugging for payment completion errors
lalit-swain-cko Oct 7, 2025
791a096
Fix Flow component validation and prevent empty payment ID submission
lalit-swain-cko Oct 7, 2025
2da9db4
Add enhanced debugging for regular user payments on order-pay page
lalit-swain-cko Oct 7, 2025
d1d495b
Fix JavaScript error preventing Flow component from working
lalit-swain-cko Oct 7, 2025
42359be
Restore immediate form submission for proper redirection
lalit-swain-cko Oct 8, 2025
cb73797
Add enhanced debugging for form submission and redirection
lalit-swain-cko Oct 8, 2025
830390c
Fix 3DS order-pay redirects and cardholder name auto-population
lalit-swain-cko Oct 10, 2025
e992c93
Add production-ready staging zip with order-pay 3DS fixes and cardhol…
lalit-swain-cko Oct 10, 2025
8512aa8
Remove old staging zip file (checkout-com-staging-20251008-002123.zip)
lalit-swain-cko Oct 10, 2025
1c40008
Update documentation with latest order-pay 3DS fixes and cardholder n…
lalit-swain-cko Oct 10, 2025
c943447
Fix Flow integration field names to match working version
lalit-swain-cko Oct 10, 2025
b49c0c4
Fix discount calculation in Flow integration
lalit-swain-cko Oct 10, 2025
8c7d70b
Add discount calculation fix zip file
lalit-swain-cko Oct 10, 2025
c1d0ae3
Fix saved card submission logic in Flow integration
lalit-swain-cko Oct 10, 2025
2f4f985
Add saved card submission fix zip file
lalit-swain-cko Oct 10, 2025
c70a71d
fix: Remove legacy UI and fix webhook order lookup for production
lalit-swain-cko Oct 13, 2025
3f46209
chore: Update deployment zip with legacy UI cleanup
lalit-swain-cko Oct 13, 2025
117c17f
chore: Rename deployment zip to meaningful name
lalit-swain-cko Oct 13, 2025
597f90a
docs: Add comprehensive installation and upgrade guide
lalit-swain-cko Oct 14, 2025
a9ba1f4
Phase 1: Add WooCommerce Blocks compatibility layer
lalit-swain-cko Oct 16, 2025
eb780f9
Fix critical errors and enhance Flow integration
lalit-swain-cko Oct 21, 2025
45c1d4c
Improve PayPal Express checkout to skip checkout page
lalit-swain-cko Oct 21, 2025
2dc2cf7
Add PayPal Express location settings (product, shop, cart) and master…
Nov 3, 2025
5f4a5fb
Merge v0.zip improvements: robust master toggle handling and better e…
Nov 3, 2025
dffe5f0
Update documentation: Add PayPal Express settings guide and replace o…
Nov 3, 2025
d44bf7c
Add E2E test build and improvements
Nov 4, 2025
03381ea
Revert shop page express checkout to simple style
Nov 9, 2025
85e37d1
Improve express checkout button rendering and remove Apple Pay Call t…
Nov 9, 2025
3b18408
feat: Add conditional webhook logging based on gateway responses setting
Nov 11, 2025
e58d3a2
chore: Add plugin zip build 20251111
Nov 11, 2025
77fb65c
chore: Add plugin zip build 20251111 and remove old zip
Nov 11, 2025
b217fbe
Simplify Flow initialization and fix gateway availability issues
Nov 12, 2025
d12fe2c
Remove build artifacts: Clean up 71 zip files from repository
Nov 12, 2025
8b04d61
Consolidate documentation: Merge 22 files into 3 organized guides
Nov 12, 2025
203dda2
feat: Add duplicate order prevention and improve saved cards UI
Nov 13, 2025
91491a1
fix: Update plugin header for WordPress compatibility
Nov 13, 2025
c54ceb0
docs: Add plugin update compatibility documentation
Nov 13, 2025
d38d998
fix: Restore 100 character truncation for payment description field
Nov 13, 2025
4633901
Fix: Prevent order status overwrite from Processing to On hold when c…
Nov 18, 2025
2e7fe46
Add client-ready plugin zip file (v5.0.0-beta)
Nov 18, 2025
c67c2f7
Fix critical webhook and payment flow issues
Nov 20, 2025
edf09a5
Update plugin zip file with latest fixes
Nov 20, 2025
59fcc10
Add latest plugin zip file with all fixes
Nov 20, 2025
8550509
Add comprehensive manual test cases document
Nov 20, 2025
48067e3
Fix: Ensure billing and shipping addresses are saved for Flow payments
Nov 20, 2025
d435b82
Update zip file with address fixes for Flow payments
Nov 20, 2025
07c887e
feat: Security fixes, webhook improvements, and version bump to 5.0.1…
Nov 25, 2025
227ff2a
Add plugin zip file with Guzzle compatibility fix (2025-11-27)
Nov 27, 2025
611f947
Security: Add payment amount validation and webhook amount logging
Dec 1, 2025
bbe60ae
Build: Update plugin zip file with security fixes and webhook improve…
Dec 1, 2025
02f089b
Fix: Guest user save card checkbox visibility and add text alignment …
Dec 12, 2025
a5026fb
Add: Updated plugin zip file with latest fixes
Dec 12, 2025
3849b71
Remove: Delete old zip file checkout-com-unified-payments-api-2025-11…
Dec 12, 2025
35e3132
Production readiness: Remove default card selection, add debug settin…
Dec 15, 2025
b9abba9
Update plugin zip file with production-ready changes
Dec 15, 2025
fc93009
Add comprehensive logging for order creation validation and webhook m…
Dec 16, 2025
e1731e7
Update version to 5.0.1-beta.5
Dec 16, 2025
9a067d7
Update plugin zip file to version 5.0.1-beta.5
Dec 16, 2025
8bcc467
Sync plugin PHP files: logger level fix, subscription detection, webh…
Dec 16, 2025
37ee61b
Update root plugin file version to 5.0.1-beta.5
Dec 16, 2025
e98fe43
feat: Add Flow Integration v5.0.1-beta.5
Dec 16, 2025
f2a10cb
Add missing Flow JS files: flow-container.js and flow-customization.js
Dec 16, 2025
6946094
Add missing files from beta branch
Dec 16, 2025
f9e5a5b
Add remaining missing files
Dec 16, 2025
d9f82a6
Merge beta branch: Add all plugin files from feature/flow-integration…
Dec 16, 2025
5724f21
fix: Restructure plugin files to match beta branch structure
Dec 16, 2025
952cff1
fix: Update build script to copy from checkout-com-unified-payments-a…
Dec 16, 2025
0b754d3
fix: Add all missing files from beta zip to match beta structure exactly
Dec 16, 2025
208d48a
fix: Update bin/build.sh to use correct structure matching build-corr…
Dec 16, 2025
1463ea9
chore: Remove build-correct-zip.sh - functionality now in bin/build.sh
Dec 16, 2025
2d09db7
fix: Update main plugin file to match beta version
Dec 16, 2025
3caf9ba
fix: Add missing files from beta to match beta structure exactly
Dec 16, 2025
98fc568
chore: Update version from 5.0.1-beta.5 to 5.0.0
Dec 16, 2025
92d8241
docs: Update README.md for Flow integration v5.0.0
Dec 16, 2025
e8024e8
docs: Improve Flow Integration Details section for better readability
Dec 16, 2025
b14a0a4
Fix: Account creation fields only required when account creation is e…
Dec 16, 2025
6db4c01
Add duplicate prevention to webhook queue processing
Dec 17, 2025
66df19e
feat: Add payment session ID and payment ID protection
Dec 17, 2025
9762f9a
Merge release/v5.0.0 into master - payment ID protection features
Dec 17, 2025
87df43d
feat: Add payment session ID and payment ID protection
Dec 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
372 changes: 372 additions & 0 deletions WEBHOOK_MATCHING_LOG_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,372 @@
# Webhook Matching - Log Analysis Guide

This guide shows you exactly what to search for in logs to trace how a payment webhook was matched to an order.

---

## 🔍 **Quick Search Guide**

### **Step 1: Find the Webhook Entry**

Search for the **Payment ID** from the order notes:
```
pay_u43vgdybaz5ybexffmkkytorxu
```

Or search for:
```
WEBHOOK MATCHING: ========== STARTING ORDER LOOKUP ==========
```

---

## 📋 **Complete Log Sequence**

### **1. Webhook Received (Start)**

**Search:** `WEBHOOK MATCHING: ========== STARTING ORDER LOOKUP ==========`

**What you'll see:**
```
WEBHOOK MATCHING: ========== STARTING ORDER LOOKUP ==========
WEBHOOK MATCHING: Event Type: payment_captured
WEBHOOK MATCHING: Payment ID: pay_u43vgdybaz5ybexffmkkytorxu
WEBHOOK MATCHING: Session ID in metadata: ps_xxxxx (or NOT SET)
WEBHOOK MATCHING: Order ID in metadata: 12345 (or NOT SET)
```

**What this tells you:**
- ✅ Webhook event type
- ✅ Payment ID from webhook
- ✅ Session ID (if present)
- ✅ Order ID (if present in metadata)

---

### **2. Method 1: Order ID from Metadata**

**Search:** `WEBHOOK MATCHING: Trying METHOD 1`

**What you'll see if Order ID exists:**
```
WEBHOOK MATCHING: Trying METHOD 1 (Order ID from metadata): 12345
WEBHOOK MATCHING: ✅ MATCHED BY METHOD 1 (Order ID from metadata) - Order ID: 12345
```

**OR if Order ID not found:**
```
WEBHOOK MATCHING: Trying METHOD 1 (Order ID from metadata): 12345
WEBHOOK MATCHING: ❌ METHOD 1 FAILED - Order ID 12345 not found
```

**What this tells you:**
- ✅ If order_id was in webhook metadata
- ✅ If order was found by order_id
- ❌ If order_id was missing or order not found

---

### **3. Method 2: Combined (Session ID + Payment ID)**

**Search:** `WEBHOOK MATCHING: METHOD 2` or `COMBINED`

**What you'll see if matched:**
```
WEBHOOK MATCHING: ✅ MATCHED BY METHOD 2 (COMBINED: Session ID + Payment ID) - Order ID: 12345
```

**OR if failed:**
```
WEBHOOK MATCHING: ❌ METHOD 2 FAILED - No order found by COMBINED match (Session ID: ps_xxxxx, Payment ID: pay_xxxxx)
```

**What this tells you:**
- ✅ Most reliable matching method (requires BOTH session ID and payment ID)
- ✅ Order found by combined identifiers
- ❌ If either session ID or payment ID missing/doesn't match

---

### **4. Method 3: Payment ID Alone**

**Search:** `WEBHOOK MATCHING: METHOD 3` or `PAYMENT ID ALONE`

**What you'll see if matched:**
```
WEBHOOK MATCHING: ✅ MATCHED BY METHOD 3 (PAYMENT ID ALONE) - Order ID: 12345
WEBHOOK MATCHING: ⚠️ WARNING: Matched by payment ID alone (less reliable than combined match)
```

**OR if failed:**
```
WEBHOOK MATCHING: ❌ METHOD 3 FAILED - No order found by payment ID: pay_xxxxx
```

**What this tells you:**
- ✅ Fallback method (less reliable)
- ✅ Order found by payment ID only
- ⚠️ Warning that this is less reliable
- ❌ If payment ID doesn't match any order

---

### **5. Order Details (If Found)**

**Search:** `WEBHOOK MATCHING: ✅ ORDER FOUND`

**What you'll see:**
```
WEBHOOK MATCHING: ✅ ORDER FOUND - Order ID: 12345
WEBHOOK MATCHING: Order Status: pending
WEBHOOK MATCHING: Order Payment Session ID: ps_xxxxx
WEBHOOK MATCHING: Order Payment ID (_cko_flow_payment_id): pay_xxxxx
WEBHOOK MATCHING: Order Payment ID (_cko_payment_id): pay_xxxxx
```

**What this tells you:**
- ✅ Order was successfully matched
- ✅ Current order status
- ✅ Payment session ID stored on order
- ✅ Payment IDs stored on order (both fields)

---

### **6. Order Not Found**

**Search:** `WEBHOOK MATCHING: ❌ ORDER NOT FOUND`

**What you'll see:**
```
WEBHOOK MATCHING: ❌ ORDER NOT FOUND - No matching order found
Flow webhook: No order found for webhook processing. Payment ID: pay_xxxxx - Will attempt to queue or process via webhook handlers
```

**What this tells you:**
- ❌ All 3 methods failed
- ✅ Webhook will be queued (if payment_approved or payment_captured)
- ✅ Checkout.com will retry (for other webhook types)

---

### **7. Payment ID Validation**

**Search:** `WEBHOOK MATCHING: Payment ID mismatch` or `Payment ID validation`

**What you'll see if mismatch:**
```
WEBHOOK MATCHING: ❌ CRITICAL ERROR - Payment ID mismatch in Flow webhook handler!
WEBHOOK MATCHING: Order ID: 12345
WEBHOOK MATCHING: Order _cko_flow_payment_id: pay_xxxxx
WEBHOOK MATCHING: Order _cko_payment_id: pay_xxxxx
WEBHOOK MATCHING: Expected payment ID: pay_xxxxx
WEBHOOK MATCHING: Webhook payment ID: pay_different
WEBHOOK MATCHING: ❌ REJECTING WEBHOOK - Payment ID does not match order!
```

**OR if match:**
```
Flow webhook: ✅ Payment ID validation passed - Order payment ID: pay_xxxxx, Webhook payment ID: pay_xxxxx
```

**What this tells you:**
- ✅ Payment IDs match (webhook is for correct order)
- ❌ Payment IDs don't match (webhook rejected - wrong payment)

---

### **8. Duplicate Prevention**

**Search:** `WEBHOOK: Already processed` or `WEBHOOK: ✅ Marked as processed`

**What you'll see:**
```
WEBHOOK: ✅ Already processed - Payment ID: pay_xxxxx, Type: payment_captured, Order: 12345
WEBHOOK: ✅ Skipping duplicate webhook processing to prevent multiple order updates
```

**OR:**
```
WEBHOOK: ✅ Marked as processed - Payment ID: pay_xxxxx, Type: payment_captured, Order: 12345
```

**What this tells you:**
- ✅ Webhook already processed (duplicate prevention working)
- ✅ Webhook marked as processed (will skip duplicates)

---

### **9. Webhook Processing**

**Search:** `WEBHOOK PROCESS:` + event type (e.g., `capture_payment`, `authorize_payment`)

**What you'll see:**
```
=== WEBHOOK PROCESS: capture_payment START ===
WEBHOOK PROCESS: Event type: payment_captured
WEBHOOK PROCESS: Order ID from metadata: 12345
WEBHOOK PROCESS: Payment ID: pay_xxxxx
WEBHOOK PROCESS: Order loaded successfully - Order ID: 12345, Status: pending
WEBHOOK PROCESS: Order status updated to: processing
=== WEBHOOK PROCESS: capture_payment END (SUCCESS) ===
```

**What this tells you:**
- ✅ Webhook handler executed
- ✅ Order was found and loaded
- ✅ Order status was updated
- ✅ Processing completed successfully

---

## 🔎 **Search Patterns for Specific Scenarios**

### **Scenario 1: Find How Order Was Matched**

**Search:** Payment ID + `WEBHOOK MATCHING: ✅ MATCHED BY METHOD`

**Example:**
```
pay_u43vgdybaz5ybexffmkkytorxu WEBHOOK MATCHING: ✅ MATCHED BY METHOD
```

**Result:** Shows which method (1, 2, or 3) matched the order

---

### **Scenario 2: Find Why Matching Failed**

**Search:** Payment ID + `WEBHOOK MATCHING: ❌`

**Example:**
```
pay_u43vgdybaz5ybexffmkkytorxu WEBHOOK MATCHING: ❌
```

**Result:** Shows which methods failed and why

---

### **Scenario 3: Find Payment ID Mismatch**

**Search:** Payment ID + `Payment ID mismatch` or `REJECTING WEBHOOK`

**Example:**
```
pay_u43vgdybaz5ybexffmkkytorxu Payment ID mismatch
```

**Result:** Shows if webhook was rejected due to payment ID mismatch

---

### **Scenario 4: Find Duplicate Webhook**

**Search:** Payment ID + `Already processed`

**Example:**
```
pay_u43vgdybaz5ybexffmkkytorxu Already processed
```

**Result:** Shows if webhook was skipped as duplicate

---

### **Scenario 5: Find Queued Webhook**

**Search:** Payment ID + `WEBHOOK QUEUE`

**Example:**
```
pay_u43vgdybaz5ybexffmkkytorxu WEBHOOK QUEUE
```

**Result:** Shows if webhook was queued (order not found yet)

---

## 📊 **Log Analysis Checklist**

For a specific payment, check these in order:

1. ✅ **Webhook Received**
- Search: `WEBHOOK MATCHING: ========== STARTING ORDER LOOKUP ==========`
- Check: Payment ID, Session ID, Order ID in metadata

2. ✅ **Matching Method Used**
- Search: `WEBHOOK MATCHING: ✅ MATCHED BY METHOD`
- Check: Which method (1, 2, or 3) matched

3. ✅ **Order Details**
- Search: `WEBHOOK MATCHING: ✅ ORDER FOUND`
- Check: Order ID, Status, Payment IDs

4. ✅ **Payment ID Validation**
- Search: `Payment ID validation` or `Payment ID mismatch`
- Check: If payment IDs match

5. ✅ **Duplicate Check**
- Search: `Already processed` or `Marked as processed`
- Check: If webhook was already processed

6. ✅ **Processing Result**
- Search: `WEBHOOK PROCESS:` + event type
- Check: If webhook was processed successfully

---

## 🎯 **Example: Complete Log Trace**

For payment `pay_u43vgdybaz5ybexffmkkytorxu`:

```
1. WEBHOOK MATCHING: ========== STARTING ORDER LOOKUP ==========
2. WEBHOOK MATCHING: Event Type: payment_captured
3. WEBHOOK MATCHING: Payment ID: pay_u43vgdybaz5ybexffmkkytorxu
4. WEBHOOK MATCHING: Session ID in metadata: ps_xxxxx
5. WEBHOOK MATCHING: Order ID in metadata: NOT SET
6. WEBHOOK MATCHING: ❌ METHOD 1 FAILED - Order ID not found
7. WEBHOOK MATCHING: ✅ MATCHED BY METHOD 2 (COMBINED: Session ID + Payment ID) - Order ID: 12345
8. WEBHOOK MATCHING: ✅ ORDER FOUND - Order ID: 12345
9. WEBHOOK MATCHING: Order Status: pending
10. Flow webhook: ✅ Payment ID validation passed
11. WEBHOOK PROCESS: capture_payment START
12. WEBHOOK PROCESS: Order status updated to: processing
13. WEBHOOK PROCESS: capture_payment END (SUCCESS)
14. WEBHOOK: ✅ Marked as processed - Payment ID: pay_u43vgdybaz5ybexffmkkytorxu
```

**Analysis:**
- ✅ Webhook received for `payment_captured` event
- ✅ Order ID NOT in metadata (normal for Flow checkout)
- ✅ Method 1 failed (no order_id in metadata)
- ✅ Method 2 succeeded (matched by Session ID + Payment ID)
- ✅ Payment ID validation passed
- ✅ Webhook processed successfully
- ✅ Order status updated to `processing`

---

## 🔧 **Log File Location**

Logs are written to:
- **WordPress Debug Log:** `wp-content/debug.log` (if `WP_DEBUG_LOG` enabled)
- **Checkout.com Plugin Logs:** Check plugin settings for log location
- **Server Error Logs:** Check your hosting provider's error logs

---

## 💡 **Tips**

1. **Use Payment ID as primary search term** - It's unique and appears in all relevant logs
2. **Search for "WEBHOOK MATCHING:"** - Shows the matching process
3. **Search for "WEBHOOK PROCESS:"** - Shows the processing result
4. **Check timestamps** - Match logs with order note timestamps
5. **Look for ❌ and ✅** - Quick visual indicators of success/failure

---

**Last Updated:** 2025-01-17
**Version:** 5.0.0


Loading
Loading