Billing Logs
Overview
The Admin Billing Logs page provides a detailed view of all payment processor activity. This is an essential debugging and monitoring tool that captures every interaction between the platform and payment providers, including webhooks, API calls, errors, and informational messages.
Key capabilities include:
- View all payment processor log entries
- Filter logs by provider, message type, and date range
- Search through log messages and details
- Monitor error rates and debug payment issues
- Track webhook deliveries and responses
- View JSON details for complex log entries
- Paginated navigation for large log volumes
System Requirements
PHP Requirements
PHP Extensions Required
mysqli- Database connectivityjson- JSON decoding for log detailssession- Session management for CSRF protection
PHP Settings
session.autostart = Off
date.timezone = Your/Timezone
Features & UI Elements
Page Header
[Screenshot: billing-logs-header]
The page header displays:
- Title: "Billing Logs"
- Icon:
fa-file-alt(document icon) - Breadcrumb: Dashboard / Billing / Logs
Statistics Dashboard
[Screenshot: billing-logs-stats]
Four statistics cards showing log overview:
Filter Panel
[Screenshot: billing-logs-filters]
A filter panel with the following options:
Action Buttons:
- Apply Filters (Green) - Apply selected filters
- Clear Filters - Reset all filters to default
Logs Table
[Screenshot: billing-logs-table]
The main log display table:
Type Badges:
Log Detail Modal
[Screenshot: billing-logs-modal]
When clicking "View Details", a modal displays:
Log Information:
- Log ID
- Provider name
- Message type
- Full message text
- Timestamp
Details Section:
- Formatted JSON display (if messagedetails contains JSON)
- Or plain text display for non-JSON content
- Related transaction ID (if linked)
- IP address (if logged)
Pagination
- 100 log entries per page
- Previous/Next navigation
- Page number links
- Maintains filter parameters across pages
Step-by-Step Usage
Viewing Recent Logs
- Navigate to Admin Panel → Billing → Logs
- Logs display in reverse chronological order (newest first)
- Browse through entries in the table
- Click "View Details" to see full log entry
Filtering by Provider
- Open the filter panel
- Select a provider from the Provider dropdown
- Click Apply Filters
- Only logs from that provider are shown
Filtering by Message Type
- Open the filter panel
- Select a type from the Type dropdown:
- Debug - Detailed technical information
- Info - Standard operational messages
- Error - Problems requiring attention
- Click Apply Filters
Filtering by Date Range
- Click the Date From picker and select a start date
- Click the Date To picker and select an end date
- Click Apply Filters
- Only logs within the range are shown
Searching Logs
- Enter a search term in the Search field
- Click Apply Filters
- Results match against:
- messagetxt (summary)
- messagedetails (JSON/text content)
Useful Search Terms:
Viewing Full Log Details
- Find the log entry in the table
- Click the View button (eye icon)
- Modal opens with complete information:
- Full message text (not truncated)
- Formatted JSON details (if applicable)
- Related transaction link
- Technical details (IP, etc.)
- Click outside modal or press ESC to close
Analyzing Webhook Deliveries
Webhooks are critical for payment processing. To review:
- Filter by Type: Info
- Search for "webhook"
- Review webhook entries:
- Incoming webhook received
- Webhook parsed successfully
- Action taken (subscription created, payment recorded, etc.)
Healthy Webhook Flow:
Info: Received webhook from [provider]
Info: Webhook validated successfully
Info: Processing [eventtype] event
Info: Transaction [id] created successfully
Investigating Errors
- Filter by Type: Error
- Review error messages
- Click to view full details
- Common error patterns:
Authentication Errors:
Error: Invalid API key or signature
Error: Webhook signature verification failed
Solution: Verify API credentials in provider settings
Processing Errors:
Error: User not found for subscription
Error: Duplicate transaction detected
Solution: Check user linkage, review deduplication logic
Network Errors:
Error: Connection timeout to [provider]
Error: SSL certificate verification failed
Solution: Check server connectivity, update certificates
Best Practices
Log Monitoring Schedule
Error Rate Thresholds
Log Retention
-- Delete debug logs older than 30 days
DELETE FROM tblBillingLog
WHERE messagetype = 0
AND addeddate < DATESUB(NOW(), INTERVAL 30 DAY);
-- Delete info logs older than 90 days
DELETE FROM tblBillingLog
WHERE messagetype = 1
AND addeddate < DATESUB(NOW(), INTERVAL 90 DAY);
-- Keep error logs for 1 year
DELETE FROM tblBillingLog
WHERE messagetype = 2
AND addeddate < DATESUB(NOW(), INTERVAL 365 DAY);
Common Log Patterns to Watch
Successful Transaction:
Info: Webhook received: payment.completed
Info: User #123 - Transaction created: $29.99
Info: Subscription extended to 2025-02-01
Failed Webhook:
Error: Webhook signature mismatch
Error: Could not verify request origin
Debug: Raw payload: {...}
Rebill Issue:
Info: Processing subscription rebill
Error: Payment declined - insufficient funds
Info: Subscription marked for retry
Troubleshooting
Common Issues
No Logs Appearing
Cause: Logging not enabled or table empty
Solutions:
- Check if logging is enabled in processor config
- Verify tblBillingLog table exists
- Test with a manual log entry:
INSERT INTO tblBillingLog
(internalproviderid, messagetype, messagetxt, addeddate)
VALUES (1, 1, 'Test log entry', NOW());
- If table doesn't exist, run CREATE TABLE from Installation Requirements
Logs Not Recording Webhooks
Cause: Webhook endpoint not logging
Solutions:
- Check processor class implements logging
- Verify webhook URL is correct in provider dashboard
- Add debug logging to webhook endpoint:
// At start of webhook handler
$log->write(0, 'Webhook received: ' . $SERVER['REQUESTURI']);
- Check server error logs for PHP errors in webhook handler
JSON Details Not Displaying
Cause: Invalid JSON stored in messagedetails
Solutions:
- Check if data is valid JSON:
SELECT logid, messagedetails
FROM tblBillingLog
WHERE JSONVALID(messagedetails) = 0
AND messagedetails IS NOT NULL
LIMIT 10;
- Review processor logging code
- Ensure proper JSON encoding before storage
Filter Not Working
Cause: Date format or SQL issue
Solutions:
- Verify date format matches database (YYYY-MM-DD)
- Check for timezone mismatches
- Verify SQL query is building correctly
- Clear all filters and try one at a time
Database Issues
Table Growing Too Large
Cause: No log rotation implemented
Solution:
- Check current size:
SELECT
COUNT(*) as totalrows,
ROUND(DATALENGTH/1024/1024, 2) as datamb,
ROUND(INDEXLENGTH/1024/1024, 2) as indexmb
FROM informationschema.TABLES
WHERE TABLENAME = 'tblBillingLog';
- Implement log rotation (see Log Retention section)
- Consider archiving old logs before deletion
Provider Not in Dropdown
Cause: Provider inactive or deleted
Solution:
-- Check all providers (including inactive)
SELECT internalproviderid, providername, isactive
FROM tblPaymentProviders;
-- Find logs for missing provider ID
SELECT DISTINCT internalproviderid
FROM tblBillingLog
WHERE internalproviderid NOT IN (
SELECT internalproviderid FROM tblPaymentProviders
);
Security Considerations
Sensitive Data
- Transaction IDs and amounts
- User identifiers
- IP addresses
- Webhook payloads with personal data
Best Practices:
- Limit access to billing logs section
- Don't expose log data in URLs
- Mask sensitive fields in log display
- Implement proper session timeouts
Access Control
- Only administrators can view billing logs
- Session validation on page load
- CSRF protection on filter submissions
Data Privacy
Under GDPR and similar regulations:
- Logs containing user data must be deletable
- Consider anonymizing older logs
- Document log retention in privacy policy
Translatable Strings
{
"billinglogstitle": "Billing Logs",
"billinglogsbreadcrumb": "Dashboard / Billing / Logs",
"billinglogsstattotal": "Total Logs",
"billinglogsstatdebug": "Debug",
"billinglogsstatinfo": "Info",
"billinglogsstaterrors": "Errors",
"billinglogsfilterprovider": "All Providers",
"billinglogsfiltertype": "All Types",
"billinglogsfiltersearch": "Search logs...",
"billinglogsfilterdatefrom": "Date From",
"billinglogsfilterdateto": "Date To",
"billinglogsfilterapply": "Apply Filters",
"billinglogsfilterclear": "Clear Filters",
"billinglogstableid": "ID",
"billinglogstableprovider": "Provider",
"billinglogstabletype": "Type",
"billinglogstablemessage": "Message",
"billinglogstabledate": "Date",
"billinglogstableactions": "Actions",
"billinglogstypedebug": "Debug",
"billinglogstypeinfo": "Info",
"billinglogstypeerror": "Error",
"billinglogsmodaltitle": "Log Details",
"billinglogsmodallogid": "Log ID",
"billinglogsmodalprovider": "Provider",
"billinglogsmodaltype": "Type",
"billinglogsmodalmessage": "Message",
"billinglogsmodaldetails": "Details",
"billinglogsmodaldate": "Date",
"billinglogsmodalip": "IP Address",
"billinglogsmodaltransaction": "Related Transaction",
"billinglogsmodalclose": "Close",
"billinglogsnologs": "No log entries found",
"billinglogsnomatching": "No logs match your filters",
"billinglogsunknownprovider": "Unknown Provider",
"billinglogsviewdetails": "View Details",
"billinglogsnodetails": "No additional details available"
}
Related Documentation
- Payment Providers - Payment provider configuration
- Billing Transactions - Transaction management
- Access Packages - Subscription package setup