Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 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
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
341 changes: 298 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,318 @@
[![N|Solid](https://cdn.checkout.com/img/checkout-logo-online-payments.jpg)](https://checkout.com/)
# Checkout.com WooCommerce Plugin - Flow Integration

# Woocommerce Extension
[Checkout.com](https://www.checkout.com "Checkout.com") is a software platform that has integrated 100% of the value chain to create payment infrastructures that truly make a difference.
Checkout.com Payment Gateway plugin for WooCommerce with Flow integration support.

This extension allows shop owners to process online payments (card / alternative payments) using:
- **Frames.js** - Customisable payment form, embedded within your website
- **Apple Pay & Google Pay** - Shoppers can pay using mobile wallets
- **Alternative payments** - Shoppers can pay using local payment options (Sofort, iDEAL, Boleto ... etc.)
## Version

# Installation
You can find a full installation guide [here](https://github.com/checkout/checkout-woocommerce-plugin/wiki/Installation)
**Current Version:** 5.0.0

# Initial Setup
If you do not have an account yet, simply go to [checkout.com](https://checkout.com/) and hit the "Get Test Account" button.
## Features

# Keys
There are 3 keys to configure in the module:
- **Secret Key**
- **Public Key**
- **Private Shared Key** (not required if using v4.2.0+ of our WooCommerce plugin)
### Flow Integration
- **Checkout.com Flow** - Modern, secure payment processing using Checkout.com's Flow Web Components
- **Saved Cards** - Customers can save payment methods for future use
- **3D Secure (3DS)** - Full support for 3D Secure authentication
- **Card Validation** - Real-time card validation before order creation
- **Webhook Processing** - Reliable webhook handling with queue system
- **Order Management** - Automatic order status updates based on payment status

> The Private Shared Key is generated when you [configure the Webhook URL](https://docs.checkout.com/the-hub/manage-webhooks) in the Checkout HUB.
### Payment Methods Supported
- Credit/Debit Cards (via Flow)
- Saved Payment Methods
- Apple Pay
- Google Pay
- PayPal
- Alternative Payment Methods (APMs)

# Webhook
In order to keep WooCommerce order statuses in sync you need to configure the following webhook URL in your Checkout HUB (where _example.com_ is your store URL):
## Installation

> The following URL format is for plugins versions 4.X or newer; click [here](https://github.com/checkout/checkout-woocommerce-plugin/wiki/URLs--2.x) to get the URLs for older plugin versions
1. Download the plugin zip file: `checkout-com-unified-payments-api.zip`
2. Go to WordPress Admin → Plugins → Add New → Upload Plugin
3. Upload the zip file
4. Activate the plugin
5. Configure your Checkout.com credentials in WooCommerce → Settings → Payments → Checkout.com Payment

## Configuration

| URL Example | API Version | Events |
| ------ | ------ | ------ |
| _example.com_**/?wc-api=wc_checkoutcom_webhook**           | 2.0 | All |
### Required Settings

> You can see a guide on how to manage webhooks in the HUB [here](https://docs.checkout.com/the-hub/manage-webhooks) ; You can find test card details [here](https://docs.checkout.com/testing)
1. **Secret Key** - Your Checkout.com secret key
2. **Public Key** - Your Checkout.com public key
3. **Webhook URL** - Configure in Checkout.com Hub:
```
https://your-site.com/?wc-api=wc_checkoutcom_webhook
```

# Going LIVE
### Flow Integration Settings

Upon receiving your live credentials from your account manager, here are the required steps to start processing live transactions:
- Enable Flow payment method
- Configure Flow appearance and behavior
- Set up saved cards functionality
- Configure 3DS settings

- In the plugin settings, input your **Live** keys
- Switch the _Endpoint URL mode_ to **Live**.
## Flow Integration Details

# Development environment Setup
### Overview

- Clone the repository to in `wp-content/plugins` folder with the name `woocommerce-gateway-checkout-com`
`git clone git@github.com:checkout/checkout-woocommerce-plugin.git woocommerce-gateway-checkout-com`
or
`git clone https://github.com/checkout/checkout-woocommerce-plugin.git woocommerce-gateway-checkout-com`
- Use required `npm` version by executing `nvm use`.
- Install the `npm` packages using `npm install`.
- Install the `composer` packages using `composer install`.
- During pushing the committing the code the PHPCS check will run at pre-commit hook. **So, till the PHPCS errors are not fixed for during commit we have to use `--no-verify` option in the git commit command.**
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.

### How Flow Integration Works

# Reference
The payment flow follows these steps:

You can find our complete Documentation [here](http://docs.checkout.com/).
If you would like to be assigned an account manager, please contact us at sales@checkout.com
For help during the integration process you can contact us at integration@checkout.com
For support, you can contact us at support@checkout.com
#### Step 1: Checkout Page Load
- Customer fills out billing and shipping information
- Flow payment method is selected
- Flow Web Component is initialized and mounted

_Checkout.com is authorised and regulated as a Payment institution by the UK Financial Conduct Authority._
#### Step 2: Order Creation (Before Payment)
- **Why Early?** Orders are created via AJAX before payment processing begins
- This ensures the order exists in the database for webhook matching
- Order status: `Pending payment`
- Payment session ID is stored with the order

#### Step 3: Payment Session Creation
- Payment session is created with Checkout.com API
- Session includes order details, customer information, and amount
- Payment session ID is returned and stored

#### Step 4: Flow Component Validation
- **Client-Side Validation**: Flow component validates card details in real-time
- Card number, expiry, CVV are validated before submission
- Invalid cards are rejected before payment attempt

#### Step 5: Payment Processing
- Customer submits payment through Flow component
- Payment is processed securely through Checkout.com
- For 3D Secure: Customer is redirected for authentication
- Payment result is returned

#### Step 6: Webhook Processing
- Checkout.com sends webhook with payment status
- Webhook is matched to order using:
1. Order ID from metadata (primary)
2. Payment Session ID + Payment ID (secondary)
3. Payment ID alone (fallback)
- If order not found immediately, webhook is queued for later processing

#### Step 7: Order Status Update
- Order status is automatically updated based on payment result:
- ✅ **Payment Approved** → Order status: `Processing`
- ✅ **Payment Captured** → Order status: `Processing` (if not already)
- ❌ **Payment Declined** → Order status: `Failed`
- ⏸️ **Payment Cancelled** → Order status: `Cancelled`

### Key Features Explained

#### 🔒 Early Order Creation
**What it does:** Creates the WooCommerce order before payment processing begins.

**Why it's important:**
- Ensures webhooks can always find the order
- Prevents webhook matching failures
- Allows order tracking throughout the payment process

**How it works:**
- Order is created via AJAX when customer clicks "Place Order"
- Order is saved with `Pending payment` status
- Payment session ID is stored for webhook matching

#### ✅ Dual Validation System
**Client-Side Validation:**
- Flow component validates card details in real-time
- Prevents invalid cards from being submitted
- Provides instant feedback to customers

**Server-Side Validation:**
- Comprehensive validation of all checkout fields
- Validates billing/shipping addresses
- Ensures data integrity before order creation
- Blocks order creation if validation fails

#### 🚫 Duplicate Prevention
**Problem:** Multiple clicks or slow networks can cause duplicate orders.

**Solution:**
- Client-side lock prevents multiple simultaneous requests
- Server-side check prevents duplicate orders with same payment session ID
- If duplicate detected, existing order is returned instead of creating new one

#### 📬 Webhook Queue System
**Problem:** Webhooks might arrive before order is fully saved to database.

**Solution:**
- Webhook queue temporarily stores webhooks if order not found
- Queue is processed when order becomes available
- Ensures no webhooks are lost
- Automatic retry mechanism

#### 🔐 3D Secure (3DS) Support
**How it works:**
1. Payment requires 3DS authentication
2. Customer is redirected to bank's 3DS page
3. Customer completes authentication
4. Customer is redirected back to store
5. Payment status is confirmed via webhook
6. Order status is updated accordingly

**Features:**
- Automatic 3DS detection
- Seamless redirect flow
- Webhook handling after 3DS return
- Prevents duplicate status updates

#### 💳 Saved Cards
**How it works:**
1. Customer opts to save card during checkout
2. Card is tokenized securely by Checkout.com
3. Token is stored in customer's account
4. Saved cards appear on future checkouts
5. Customer can select saved card for quick checkout

**Security:**
- Cards are never stored on your server
- Only secure tokens are stored
- PCI compliance handled by Checkout.com
- Cards can be deleted by customer

### Payment Flow Diagram

```
Customer Checkout
Fill Billing/Shipping Info
Select Flow Payment Method
Click "Place Order"
[VALIDATION] Client-Side + Server-Side
[ORDER CREATED] Status: Pending payment
Create Payment Session with Checkout.com
[FLOW COMPONENT] Card Details Entered
[VALIDATION] Flow Component Validates Card
Submit Payment
[3DS?] If Required → Redirect → Authenticate → Return
Payment Processed
[WEBHOOK] Payment Status Received
Match Webhook to Order
Update Order Status
[COMPLETE] Order Status: Processing/Failed
```

### Technical Architecture

#### Frontend (JavaScript)
- **payment-session.js**: Handles order creation, payment session, Flow component integration
- **flow-container.js**: Manages Flow component container and initialization
- **flow-customization.js**: Customizes Flow component appearance and behavior

#### Backend (PHP)
- **class-wc-gateway-checkout-com-flow.php**: Main gateway class, handles payment processing
- **Webhook Handler**: Processes incoming webhooks and updates orders
- **Webhook Queue**: Manages webhook queuing system

#### Database
- Order meta stores: Payment Session ID, Payment ID, Webhook IDs
- Webhook queue table: Temporary storage for unmatched webhooks

## Webhook Configuration

Configure the following webhook URL in your Checkout.com Hub:

```
https://your-site.com/?wc-api=wc_checkoutcom_webhook
```

### Webhook Events Supported

- `payment_approved`
- `payment_captured`
- `payment_declined`
- `payment_cancelled`
- `payment_voided`
- `payment_refunded`

## Development

### Building the Plugin

Use the build script to create the plugin zip:

```bash
./bin/build.sh
```

This will create `checkout-com-unified-payments-api.zip` with the correct WordPress plugin structure.

### File Structure

```
checkout-com-unified-payments-api/
├── woocommerce-gateway-checkout-com.php # Main plugin file
├── flow-integration/ # Flow integration
│ ├── class-wc-gateway-checkout-com-flow.php
│ └── assets/
│ ├── js/
│ │ ├── payment-session.js
│ │ ├── flow-container.js
│ │ └── flow-customization.js
│ └── css/
│ └── flow.css
├── includes/ # Core functionality
│ ├── api/
│ ├── settings/
│ ├── admin/
│ └── ...
├── assets/ # Frontend assets
├── lib/ # Libraries
└── vendor/ # Composer dependencies
```

## Requirements

- WordPress 5.0+
- WooCommerce 3.0+
- PHP 7.3+
- SSL Certificate (required for production)

## Support

For support and integration help:
- **Integration Support**: integration@checkout.com
- **General Support**: support@checkout.com
- **Sales**: sales@checkout.com

## License

MIT License

## Changelog

### Version 5.0.0
- Initial Flow integration release
- Complete Flow Web Components integration
- Saved cards functionality
- 3D Secure support
- Webhook queue system
- Enhanced order management
- Comprehensive validation and error handling

## Documentation

For detailed documentation, visit: [Checkout.com Documentation](https://docs.checkout.com)

---

**Checkout.com** is authorised and regulated as a Payment institution by the UK Financial Conduct Authority.
Loading
Loading