Billit Woo Connect
Billit WooCommerce Integration
A comprehensive WordPress plugin that seamlessly integrates WooCommerce with Billit for automated invoice and credit note creation, featuring advanced VAT handling, bi-directional PDF management, and Peppol network integration.
๐ Key Features
Core Integration
- Automatic Invoice Creation: Smart invoice generation when orders reach configured statuses
- Advanced Credit Note System: Handles full/partial refunds including shipping and fees
- Peppol Network Integration: Automatic B2B invoice delivery via European Peppol network
- Bi-Directional PDF Management: Upload WooCommerce PDFs to Billit and download Billit PDFs
- Real-Time Status Tracking: Visual indicators and comprehensive order notes
Advanced VAT & Customer Handling
- Multi-Country VAT Detection: Automatic VAT number extraction and validation (BE, NL, DE, FR, GB)
- Smart Customer Classification: Automatic B2B vs B2C detection with proper tax handling
- POS System Support: VAT extraction from company names in POS orders
- Company Name Cleaning: Removes embedded VAT numbers for professional appearance
Professional Admin Interface
- Dual Meta Box System: Separate interfaces for operations and PDF management
- PDF Download Icons: Direct PDF access from orders list overview
- AJAX Operations: Real-time processing with progress indicators
- Manual Override Options: Full manual control when needed
Enterprise-Grade Reliability
- Comprehensive Error Handling: Detailed logging and graceful error recovery
- Duplicate Prevention: Advanced logic prevents duplicate operations
- HPOS Compatibility: Full support for WooCommerce High-Performance Order Storage
- Retry Mechanisms: Automatic retries for failed operations
๐ ๏ธ Technical Requirements
- WordPress: 5.0 or higher
- WooCommerce: 6.0 or higher
- PHP: 7.4 or higher
- Billit Account: Active account with API access
- SSL: HTTPS required for API communications
๐ฆ Installation
-
Upload Plugin Files:
/wp-content/plugins/billit_woo_connect/ -
Activate Plugin:
- Navigate to Plugins โ Installed Plugins
- Find "Billit WooCommerce Integration"
- Click Activate
-
Initial Configuration:
- Go to Settings โ Billit Integration
- Enter your Billit API credentials
- Configure processing preferences
- Test API connection
โ๏ธ Configuration Guide
API Settings
API Key: [Your Billit API Key]
Company ID: [Your Billit Company ID]
API Environment:
โข Sandbox: https://api.sandbox.billit.be/v1
โข Production: https://api.billit.be/v1
Processing Settings
-
โ Enable Automatic Processing: Smart automation for invoices and credit notes -
๐ Auto-Invoice Statuses: Configure which order statuses trigger invoice creation -
๐ค Automatic Peppol Sending: Auto-send B2B invoices via Peppol network -
๐ง Processing Mode: Choose between different integration levels
PDF Management
-
๐ Upload PDFs to Billit: Attach WooCommerce PDFs to Billit orders -
๐ฅ Download PDFs from Billit: Retrieve and store Billit-generated PDFs -
โฑ๏ธ Auto-Retrieval: Scheduled PDF downloading after invoice/credit note creation -
๐ฅ Frontend Display Control: Toggle customer visibility of PDFs on My Account page (enabled by default)
Order Configuration
-
๐ท๏ธ Order Number Prefix: Customize prefixes for Billit orders (default: "WC-") -
๐ Invoice Expiry: Set payment terms (default: 30 days) -
๐ผ Credit Note References: Automatic linking to original invoices
๐ฏ Usage Guide
Automatic Processing Flow
Invoice Creation:
- Customer places order โ WooCommerce processes payment
- Order reaches configured status (e.g., "Processing")
- Plugin detects VAT number and classifies customer (B2B/B2C)
- Creates invoice in Billit with proper VAT handling
- Sends via Peppol (for B2B customers) or stores for manual sending
- Retrieves and attaches PDF to WooCommerce order
Credit Note Creation:
- Merchant processes refund in WooCommerce
- Plugin detects refund components (products + shipping + fees)
- Creates comprehensive credit note in Billit
- Links to original invoice reference
- Sends via Peppol (if original was B2B)
- Retrieves and attaches credit note PDF
Manual Operations
From Order Edit Page:
-
Billit Integration Meta Box:
-
๐ View current status (invoice/credit note creation) -
๐ Manual "Create Invoice" and "Create Credit Note" buttons -
โ Real-time status updates with detailed information
-
-
Billit PDF Downloads Meta Box:
-
๐ View all downloaded PDFs (invoices, credit notes) -
๐ฅ "Download All PDFs" or individual PDF downloads -
๐ "Refresh All PDFs" to update existing files -
๐ File size, dates, and document type indicators
-
From Orders List:
- Billit Status Column: Shows operation status at a glance
-
PDF Download Icons: Direct download links for available PDFs
-
๐ = Invoice PDF available -
๐งพ = Credit Note PDF available - Click any icon for instant PDF download
-
Advanced Features
VAT Number Detection:
Automatic detection from:
โข Customer billing fields (vat_number, billing_vat_number)
โข Company names (embedded VAT: "Company BE0123456789")
โข Multi-country format handling and validation
POS System Integration:
Input: "Beauty Salon BE1234567890"
Output:
โข Company: "Beauty Salon" (cleaned)
โข VAT Number: "BE1234567890" (extracted)
โข Classification: B2B Customer
Comprehensive Refund Handling:
Refund Components Detected:
โข Product refunds (with quantities and VAT)
โข Shipping cost refunds (with proper tax calculation)
โข Payment gateway fees and handling fees
โข All components properly categorized in credit notes
๐ง API Integration Details
Invoice Payload Structure
{
"OrderType": "Invoice",
"OrderDirection": "Income",
"Customer": {
"VATLiable": true,
"VATDeductable": true,
"VATNumber": "BE0123456789",
"ContactFirstName": "John",
"ContactLastName": "Doe"
},
"OrderLines": [
{
"Quantity": 2,
"UnitPriceExcl": 25.00,
"Description": "Product Name",
"VATPercentage": 21
}
]
}
Credit Note Features
{
"OrderType": "CreditNote",
"AboutInvoiceNumber": "WC-1234",
"Paid": true,
"PaidDate": "2025-12-17",
"OrderLines": [
{"Description": "Product Refund", "Quantity": 1, "UnitPriceExcl": 25.00},
{"Description": "Shipping Refund", "Quantity": 1, "UnitPriceExcl": 5.00},
{"Description": "Fee Refund", "Quantity": 1, "UnitPriceExcl": 2.00}
]
}
PDF Management APIs
-
Upload:
POST /v1/orders/{id}/attachments(multipart/form-data) -
Download:
GET /v1/files/{fileId}(base64 content) - Storage: WordPress media library with organized metadata
๐ Order Notes & Tracking
Invoice Operations
โ
Billit Invoice Created Successfully
โข Invoice ID: 2219533
โข Order Number: WC-2922
โข Amount: โฌ 109,00
โข Created: 2025-11-11 23:45:57
โข Auto-send via Peppol: Enabled (B2B customer)
๐ค Invoice sent via Peppol network successfully
๐ฅ Billit PDF retrieved and attached to order
Credit Note Operations
๐ Billit Credit Note Created Successfully
โข Credit Note ID: 2219544
โข Original Invoice: WC-2922
โข Refund Amount: โฌ 48,00
โข Components: Products (โฌ38) + Shipping (โฌ10)
โข Created: 2025-11-12 01:15:23
๐ค Credit note sent via Peppol network successfully
๐ฅ Credit note PDF retrieved and attached to order
System Messages
๐ Billit automatic processing triggered (Status: processing)
โน๏ธ B2B customer detected - Peppol sending enabled
โน๏ธ Private customer - manual PDF sending required
โ API Error: [Specific error message with troubleshooting info]
๐ก๏ธ Security & Performance
Security Features
-
โ HTTPS-only API communications -
โ Secure WordPress options storage for API credentials -
โ Nonce verification for all AJAX requests -
โ Capability checks for administrative functions -
โ Input sanitization and validation -
โ Directory protection with index.php files -
โ Protected log files with .htaccess
Performance Optimizations
-
โก WordPress cron for scheduled operations -
โก AJAX for non-blocking admin operations -
โก Efficient API request batching -
โก Smart caching and duplicate prevention -
โก Optimized database queries for HPOS compatibility -
โก Settings caching to reduce database queries -
โก GitLab updater caching (12-hour cache with force-check support)
๐ Troubleshooting Guide
Enable Debug Mode
- Settings โ Billit Integration โ Enable Debug Mode
- Check WordPress error logs:
/wp-content/debug.log - Monitor real-time processing in order notes
Common Issues & Solutions
API Connection Issues
Problem: "API Connection Failed"
Solutions:
โข Verify API key and company ID are correct
โข Check API environment (sandbox vs production)
โข Test connection using admin interface
โข Ensure HTTPS is properly configured
VAT Detection Issues
Problem: "VAT number not detected"
Solutions:
โข Check customer billing fields for VAT number
โข For POS orders, ensure company name includes VAT
โข Verify VAT number format matches country standards
โข Review debug logs for detection attempts
PDF Issues
Problem: "PDF not downloading"
Solutions:
โข Ensure invoice/credit note exists in Billit first
โข Check if PDF generation completed (may take time)
โข Verify WordPress media directory permissions
โข Use manual "Retrieve PDF" button for troubleshooting
Missing Refund Components
Problem: "Shipping not included in credit note"
Solutions:
โข Ensure shipping is included in WooCommerce refund
โข Check refund amount matches product + shipping total
โข Review debug logs for refund component detection
โข Verify tax settings for shipping items
Debug Log Examples
[INFO] Starting credit note creation process
[INFO] Private customer identified
[API] API Request: POST /orders (Credit Note Creation)
[INFO] Found shipping item: Standard Shipping, total=10.00, tax=2.10
[INFO] Added shipping refund: Standard Shipping, total=10.00, tax=2.10
[API] API Response: HTTP 200 - Credit note created (ID: 2219544)
[INFO] Credit note PDF retrieval scheduled
๐ง Hooks & Filters for Developers
Available Actions
// Fired after successful operations
do_action('billit_invoice_created', $order_id, $invoice_data);
do_action('billit_credit_note_created', $order_id, $credit_note_data);
do_action('billit_pdf_retrieved', $order_id, $pdf_data);
// Before operations (allow modifications)
do_action('billit_before_invoice_creation', $order_id, &$payload);
do_action('billit_before_credit_note_creation', $order_id, &$payload);
Available Filters
// Modify customer data before sending
$customer_data = apply_filters('billit_customer_data', $customer_data, $order);
// Modify order lines before sending
$order_lines = apply_filters('billit_order_lines', $order_lines, $order);
// Modify VAT detection results
$vat_number = apply_filters('billit_detected_vat', $vat_number, $order);
๐ Performance Metrics
Typical Processing Times
- Invoice Creation: 1-3 seconds
- Credit Note Creation: 1-2 seconds
- PDF Retrieval: 2-5 seconds
- Peppol Sending: 3-10 seconds
Error Handling
- Automatic Retries: 3 attempts for failed operations
- Graceful Degradation: Continues processing even with non-critical failures
- Comprehensive Logging: Full audit trail for troubleshooting
๐ Version History
Current Version: 1.2.0
New in 1.2.0:
Core Features:
Admin Interface:
Customer & VAT Handling:
๐ Support & Development
For Technical Issues
-
๐ Plugin Issues: Check debug logs and verify configuration -
๐ API Issues: Consult Billit API documentation -
๐ WooCommerce Issues: Ensure proper WooCommerce setup -
๐ PDF Issues: Verify file permissions and media library access
Development Notes
This plugin represents approximately 12-15 hours of development creating an enterprise-grade integration that handles:
- Complex multi-API interactions (Billit v1/v2 endpoints)
- Advanced business logic for European VAT compliance
- Sophisticated file management and PDF processing
- Real-time UI with comprehensive admin interface
- Production-ready error handling and logging systems
Status: Ready for production testing and deployment!