What It Does
Automatically uploads paid WHMCS invoices to Nextcloud. WebDAV protocol. Configurable folder structures. Bulk retry for failed uploads. CSV export of upload history.
Features
Automatic Upload:
- Paid invoices upload immediately
- Cancelled invoices upload with CANCELLED_ prefix (if previously paid)
- Refunded invoices upload with CANCELLED_ prefix
- WebDAV protocol
Folder Organization:
Configurable structures:
- Year/Quarter/Invoices (2025/Q1/Invoices/)
- Year/Quarter (2025/Q1/)
- Year/Month (2025/01/)
- Year only (2025/)
- Flat (no subfolders)
Manual Operations:
- Upload specific invoice by ID
- Bulk retry failed uploads (max 50)
- Export logs to CSV
- Real-time connection testing
Logging:
- Activity log with client names
- Upload status tracking
- Error details
- Admin to-do for failures
File Naming:
Format: YYYYMMDD_InvoiceNum_ClientName.pdf
Cancelled: YYYYMMDD_CANCELLED_InvoiceNum_ClientName.pdf
How It Works
Paid invoice flow:
- Invoice marked paid in WHMCS
- Hook triggers (InvoicePaid)
- Module generates PDF
- Uploads to Nextcloud via WebDAV
- Files organized by configured structure
- Success logged
Cancelled invoice flow:
- Paid invoice cancelled or refunded
- Hook triggers (InvoiceCancelled/InvoiceRefunded)
- Module checks if invoice was previously paid
- If yes: Uploads with CANCELLED_ prefix
- If no: Skips (never paid, so never uploaded)
Failed upload handling:
- Upload fails (network, permissions, etc.)
- Error logged
- Admin to-do created
- Invoice marked for retry
- Admin uses bulk retry later
Installation
- Purchase from ArkHost Store
- Upload to `/modules/addons/nextcloud_invoice_feeder/`
- Activate in Setup β Addon Modules
- Enter license key
- Configure WebDAV settings
- Test connection
- Done
Configuration
Nextcloud Setup
Generate app password:
- Log into Nextcloud
- Settings β Security
- App passwords section
- Create new app password
- Name it "WHMCS"
- Copy generated password
Why app password?
- More secure than main password
- Can revoke without changing main password
- Specific to WHMCS integration
- Required for WebDAV access
Module Configuration
WHMCS Admin β Addons β Nextcloud Invoice Feeder
License Key:
ArkHost license key.
WebDAV URL:
Full path including username folder.
Format: https://your-nextcloud.com/remote.php/dav/files/username/
Example: https://cloud.example.com/remote.php/dav/files/john/
Important:
- Must include `/remote.php/dav/files/`
- Must include your username
- Must end with `/`
- Must use HTTPS
Username:
Your Nextcloud username (same as in URL).
App Password:
Generated app password from Nextcloud (not main password).
Base Path:
Root folder for invoices in Nextcloud.
Examples:
- `Invoices/` (simple)
- `Company/Finance/Invoices/` (nested)
- Leave empty for root
Folder Structure:
Choose how to organize invoices:
Year/Quarter/Invoices:
Invoices/
βββ 2025/
βββ Q1/
βββ Invoices/
βββ 20250115_1001_Client_Name.pdf
βββ 20250120_1002_Another_Client.pdf
Year/Quarter:
Invoices/
βββ 2025/
βββ Q1/
βββ 20250115_1001_Client_Name.pdf
βββ 20250120_1002_Another_Client.pdf
Year/Month:
Invoices/
βββ 2025/
βββ 01/
βββ 20250115_1001_Client_Name.pdf
βββ 20250120_1002_Another_Client.pdf
Year:
Invoices/
βββ 2025/
βββ 20250115_1001_Client_Name.pdf
βββ 20250120_1002_Another_Client.pdf
Flat:
Invoices/
βββ 20250115_1001_Client_Name.pdf
βββ 20250120_1002_Another_Client.pdf
Test Connection:
Click "Test Connection" button after configuration.
- Success: Green checkmark
- Failure: Error message with details
Usage
Automatic Upload
No action needed. Invoices upload automatically when paid.
What gets uploaded:
- Invoice marked paid β Uploads immediately
- Invoice cancelled (was paid) β Re-uploads with CANCELLED_ prefix
- Invoice refunded β Re-uploads with CANCELLED_ prefix
What doesn't upload:
- Unpaid invoices
- Draft invoices
- Cancelled invoices (never paid)
Manual Upload
Upload specific invoice:
- Addons β Nextcloud Invoice Feeder
- Enter invoice ID
- Click "Upload Invoice"
- View result
Use when:
- Testing configuration
- Re-uploading after fixing Nextcloud
- Uploading historical invoices
- Failed automatic upload
Bulk Retry Failed Uploads
Retry all failed:
- Addons β Nextcloud Invoice Feeder
- Click "Retry Failed Uploads"
- Module processes up to 50 failed uploads
- Results displayed
When to use:
- After Nextcloud downtime
- After fixing configuration
- After fixing folder permissions
- Periodic cleanup
Limit: 50 invoices per retry (prevents timeout)
Export Logs
Download complete history:
- Click "Export Logs to CSV"
- File downloads: `nextcloud_invoice_feeder_logs_YYYYMMDD.csv`
CSV contains:
- Invoice ID
- Invoice number
- Client name
- Upload date/time
- Status (Success/Failed)
- Error message (if failed)
- File path in Nextcloud
Use for:
- Accounting reconciliation
- Audit trail
- Troubleshooting
- Backup verification
File Naming
Standard format:
YYYYMMDD_InvoiceNum_ClientName.pdf
Examples:
- `20250115_1001_John_Doe.pdf`
- `20250120_1002_Acme_Corporation.pdf`
Cancelled/refunded format:
YYYYMMDD_CANCELLED_InvoiceNum_ClientName.pdf
Examples:
- `20250115_CANCELLED_1001_John_Doe.pdf`
- `20250120_CANCELLED_1002_Acme_Corporation.pdf`
Client name sanitization:
- Spaces converted to underscores
- Special characters removed
- Length limited
- Filesystem-safe
Nextcloud Folder Structure
Module creates folders automatically:
Example with Year/Quarter/Invoices:
Nextcloud/
βββ Company/
βββ Finance/
βββ 2025/
βββ Q1/
β βββ Invoices/
β βββ 20250115_1001_Client.pdf
β βββ 20250120_1002_Client.pdf
βββ Q2/
β βββ Invoices/
βββ Q3/
βββ Invoices/
Folder creation:
- Module creates folders as needed
- Requires write permissions
- Creates nested structure automatically
- Fails if permissions insufficient
Activity Logging
All actions logged:
- Successful uploads
- Failed uploads
- Manual uploads
- Bulk retries
- Configuration changes
View logs:
WHMCS Admin β System Logs β Module Log
Filter by "nextcloud_invoice_feeder"
Log details:
- Timestamp
- Action
- Invoice ID and number
- Client name
- Success/failure
- Error message
- File path
Admin To-Do Integration
Failed upload creates to-do:
When upload fails:
- To-do created in WHMCS
- Title: "Failed Nextcloud Invoice Upload"
- Description includes:
- Invoice number
- Client name
- Error message
- Suggested action
- Assigned to admin
View to-dos:
WHMCS Admin β To-Do List
Resolve:
- Fix issue (permissions, connection, etc.)
- Use bulk retry or manual upload
- Mark to-do complete
Troubleshooting
Connection test failed:
Check WebDAV URL format:
Correct: https://cloud.example.com/remote.php/dav/files/username/
Wrong: https://cloud.example.com/username/
Wrong: http://cloud.example.com/remote.php/dav/files/username/ (no HTTPS)
Verify credentials:
- Username correct (case-sensitive)
- App password correct (not main password)
- App password not revoked
Check Nextcloud:
- WebDAV enabled
- HTTPS configured
- Network accessible from WHMCS server
Upload failed:
Check permissions:
- Nextcloud user has write access
- Base path exists
- Folder creation allowed
Check Nextcloud storage:
- Not full
- Quota not exceeded
- No file locks
Check network:
- WHMCS server can reach Nextcloud
- Firewall not blocking
- DNS resolving correctly
Review logs:
- WHMCS activity log
- Nextcloud logs
- Admin to-do details
File not appearing:
Check folder structure:
- Verify configured structure
- Check year/quarter correct
- Look in subdirectories
Check filename:
- Search by invoice number
- Look for CANCELLED_ prefix
- Check client name format
Manual upload test:
- Try uploading specific invoice
- View error message
- Fix issue
Bulk retry not working:
Check limit:
- Maximum 50 invoices per retry
- Run multiple times if needed
Check connection:
- Test connection first
- Fix any connection issues
- Verify credentials
Review results:
- Check which invoices succeeded
- Review error messages for failures
- Fix underlying issues
Use Cases
Accounting integration:
- Accountant uses Nextcloud
- Automatic invoice delivery
- No manual PDF downloads
- Organized by period
Backup and archiving:
- Invoices stored off-site
- Organized structure
- Easy retrieval
- Redundant storage
Team access:
- Share invoices with team
- Nextcloud access control
- No WHMCS admin needed
- Sync to devices
Audit compliance:
- Organized by period
- Complete history
- CSV export for auditors
- Cancelled invoices marked
When You Need This
Required if:
- Using Nextcloud for documents
- Accountant needs automatic invoice delivery
- Want off-site backup
- Team needs invoice access without WHMCS
Not required if:
- Don't use Nextcloud
- Manual invoice download acceptable
- Using different accounting software
- No document management system
Technical Specifications
Requirements:
- WHMCS 8.0+
- PHP 7.4+
- Nextcloud instance with WebDAV
- HTTPS connection
- Valid license from ArkHost
File Structure:
modules/addons/nextcloud_invoice_feeder/
βββ nextcloud_invoice_feeder.php Main module
βββ hooks.php WHMCS hooks
βββ lib/ WebDAV library
βββ lang/ Language files
Database:
- Tracks upload status
- Stores failed uploads
- Logs activity
- No additional tables (uses WHMCS tables)
Hooks:
- InvoicePaid: Triggers upload
- InvoiceCancelled: Handles cancelled
- InvoiceRefunded: Handles refunds
WebDAV:
- Protocol: WebDAV over HTTPS
- Authentication: Basic (username + app password)
- Methods: PUT, MKCOL, PROPFIND
- Automatic folder creation
Performance:
- Async upload (doesn't block WHMCS)
- Bulk retry limited to 50
- PDF generated on-demand
- Minimal WHMCS overhead
Support
Purchase:Β ArkHost Store
Before contacting support:
- Test connection in module
- Check Nextcloud app password valid
- Review WHMCS activity log
- Verify WebDAV URL format
When reporting issues:
- WHMCS version
- PHP version
- Nextcloud version
- Module version
- WebDAV URL format (without credentials)
- Error from activity log
- Connection test result