You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -52,24 +52,180 @@ Checkout.com Payment Gateway plugin for WooCommerce with Flow integration suppor
52
52
53
53
## Flow Integration Details
54
54
55
-
### How It Works
56
-
57
-
1.**Order Creation**: Order is created via AJAX before payment processing
58
-
2.**Payment Session**: Payment session is created with Checkout.com
59
-
3.**Flow Component**: Flow Web Component is mounted and validated
60
-
4.**Payment Processing**: Payment is processed through Flow
61
-
5.**Webhook Handling**: Payment status updates are received via webhooks
62
-
6.**Order Update**: Order status is automatically updated based on payment result
63
-
64
-
### Key Features
65
-
66
-
-**Early Order Creation**: Orders are created before payment to ensure webhook matching
67
-
-**Client-Side Validation**: Flow component validation before submission
68
-
-**Server-Side Validation**: Comprehensive validation on the server
69
-
-**Duplicate Prevention**: Prevents duplicate order creation
70
-
-**Webhook Queue**: Handles webhooks even if order isn't immediately found
71
-
-**3DS Support**: Full 3D Secure authentication flow
72
-
-**Saved Cards**: Secure tokenization and card saving
55
+
### Overview
56
+
57
+
The Flow integration provides a modern, secure payment experience using Checkout.com's Flow Web Components. This integration ensures reliable payment processing with comprehensive validation, webhook handling, and order management.
58
+
59
+
### How Flow Integration Works
60
+
61
+
The payment flow follows these steps:
62
+
63
+
#### Step 1: Checkout Page Load
64
+
- Customer fills out billing and shipping information
65
+
- Flow payment method is selected
66
+
- Flow Web Component is initialized and mounted
67
+
68
+
#### Step 2: Order Creation (Before Payment)
69
+
-**Why Early?** Orders are created via AJAX before payment processing begins
70
+
- This ensures the order exists in the database for webhook matching
71
+
- Order status: `Pending payment`
72
+
- Payment session ID is stored with the order
73
+
74
+
#### Step 3: Payment Session Creation
75
+
- Payment session is created with Checkout.com API
76
+
- Session includes order details, customer information, and amount
77
+
- Payment session ID is returned and stored
78
+
79
+
#### Step 4: Flow Component Validation
80
+
-**Client-Side Validation**: Flow component validates card details in real-time
81
+
- Card number, expiry, CVV are validated before submission
82
+
- Invalid cards are rejected before payment attempt
83
+
84
+
#### Step 5: Payment Processing
85
+
- Customer submits payment through Flow component
86
+
- Payment is processed securely through Checkout.com
87
+
- For 3D Secure: Customer is redirected for authentication
88
+
- Payment result is returned
89
+
90
+
#### Step 6: Webhook Processing
91
+
- Checkout.com sends webhook with payment status
92
+
- Webhook is matched to order using:
93
+
1. Order ID from metadata (primary)
94
+
2. Payment Session ID + Payment ID (secondary)
95
+
3. Payment ID alone (fallback)
96
+
- If order not found immediately, webhook is queued for later processing
97
+
98
+
#### Step 7: Order Status Update
99
+
- Order status is automatically updated based on payment result:
100
+
- ✅ **Payment Approved** → Order status: `Processing`
101
+
- ✅ **Payment Captured** → Order status: `Processing` (if not already)
102
+
- ❌ **Payment Declined** → Order status: `Failed`
103
+
- ⏸️ **Payment Cancelled** → Order status: `Cancelled`
104
+
105
+
### Key Features Explained
106
+
107
+
#### 🔒 Early Order Creation
108
+
**What it does:** Creates the WooCommerce order before payment processing begins.
109
+
110
+
**Why it's important:**
111
+
- Ensures webhooks can always find the order
112
+
- Prevents webhook matching failures
113
+
- Allows order tracking throughout the payment process
114
+
115
+
**How it works:**
116
+
- Order is created via AJAX when customer clicks "Place Order"
117
+
- Order is saved with `Pending payment` status
118
+
- Payment session ID is stored for webhook matching
119
+
120
+
#### ✅ Dual Validation System
121
+
**Client-Side Validation:**
122
+
- Flow component validates card details in real-time
123
+
- Prevents invalid cards from being submitted
124
+
- Provides instant feedback to customers
125
+
126
+
**Server-Side Validation:**
127
+
- Comprehensive validation of all checkout fields
128
+
- Validates billing/shipping addresses
129
+
- Ensures data integrity before order creation
130
+
- Blocks order creation if validation fails
131
+
132
+
#### 🚫 Duplicate Prevention
133
+
**Problem:** Multiple clicks or slow networks can cause duplicate orders.
0 commit comments