Billing Transactions
Overview
The Admin Billing Transactions page provides comprehensive oversight of all payment transactions on the platform. Administrators can view transaction history, monitor revenue metrics, filter transactions by various criteria, and track subscription lifecycles.
Key capabilities include:
- View all billing transactions with detailed information
- Monitor revenue statistics (total revenue, refunds, chargebacks)
- Filter transactions by provider, type, status, and date range
- Search transactions by user or external transaction ID
- View linked user accounts and subscription details
- Track transaction statuses (open, closed, cancelled)
- Analyze purchase patterns and rebill rates
System Requirements
PHP Requirements
PHP Extensions Required
mysqli- Database connectivityjson- JSON encoding for API responsessession- Session management for CSRF protectionmbstring- Multi-byte string handling
PHP Settings
session.autostart = Off
date.timezone = Your/Timezone
Installation Requirements
Database Tables
-- Billing Transactions Table
CREATE TABLE IF NOT EXISTS tblBillingTransactions (
transactionid INT(11) NOT NULL AUTOINCREMENT,
userid INT(11) DEFAULT NULL COMMENT 'User who made the purchase',
internalproviderid INT(11) NOT NULL COMMENT 'Payment provider used',
externalpackageid VARCHAR(100) DEFAULT NULL COMMENT 'Provider package ID',
typeid TINYINT(2) NOT NULL DEFAULT 1 COMMENT '1=Initial,2=Conversion,3=Rebill,4=Chargeback,5=Refund,6=Void,10=Tokens',
statusid TINYINT(2) NOT NULL DEFAULT 1 COMMENT '1=Open,2=Closed,3=Cancelled',
price DECIMAL(10,2) NOT NULL DEFAULT 0.00,
currencycode VARCHAR(3) DEFAULT 'USD',
externalid VARCHAR(100) DEFAULT NULL COMMENT 'Provider transaction ID',
accessstartdate DATETIME DEFAULT NULL,
accessenddate DATETIME DEFAULT NULL,
subscriptionid VARCHAR(100) DEFAULT NULL COMMENT 'Recurring subscription ID',
parenttransactionid INT(11) DEFAULT NULL COMMENT 'For rebills/refunds',
tokensgranted INT(11) DEFAULT 0 COMMENT 'Tokens added for token purchases',
ipaddress VARCHAR(45) DEFAULT NULL,
useragent TEXT DEFAULT NULL,
notes TEXT DEFAULT NULL,
addeddate DATETIME DEFAULT CURRENTTIMESTAMP,
updateddate DATETIME DEFAULT NULL ON UPDATE CURRENTTIMESTAMP,
PRIMARY KEY (transactionid),
KEY idxuserid (userid),
KEY idxproviderid (internalproviderid),
KEY idxtypeid (typeid),
KEY idxstatusid (statusid),
KEY idxexternalid (externalid),
KEY idxaddeddate (addeddate),
KEY idxsubscriptionid (subscriptionid),
KEY idxparenttransaction (parenttransactionid),
CONSTRAINT fktransactionuser FOREIGN KEY (userid)
REFERENCES tblCMSUsers (id) ON DELETE SET NULL,
CONSTRAINT fktransactionprovider FOREIGN KEY (internalproviderid)
REFERENCES tblPaymentProviders (internalproviderid) ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4unicodeci;
-- Payment Providers Table (referenced)
CREATE TABLE IF NOT EXISTS tblPaymentProviders (internalproviderid INT(11) NOT NULL AUTOINCREMENT,providername VARCHAR(100) NOT NULL,providertype VARCHAR(50) NOT NULL COMMENT 'Class name for processor',isactive TINYINT(1) DEFAULT 1,displayorder INT(11) DEFAULT 0,configuration JSON DEFAULT NULL COMMENT 'Provider-specific settings',createdat DATETIME DEFAULT CURRENTTIMESTAMP,updatedat DATETIME DEFAULT NULL ON UPDATE CURRENTTIMESTAMP,
PRIMARY KEY (internalproviderid),
KEY idxisactive (isactive),
KEY idxdisplayorder (displayorder)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4unicodeci;
-- Access Packages Table (referenced for package details)
CREATE TABLE IF NOT EXISTS tblAccessPackages (
packageid INT(11) NOT NULL AUTOINCREMENT,
providerid INT(11) NOT NULL,
externalid VARCHAR(100) DEFAULT NULL,
title VARCHAR(255) NOT NULL,
description TEXT DEFAULT NULL,
priceinitial DECIMAL(10,2) NOT NULL DEFAULT 0.00,
pricerebill DECIMAL(10,2) DEFAULT NULL,
durationinitial INT(11) DEFAULT NULL COMMENT 'Days',
durationrebill INT(11) DEFAULT NULL COMMENT 'Days',
tokens INT(11) DEFAULT 0,
packagetype ENUM('tokens', 'sitevip', 'creatorsubscription') DEFAULT 'sitevip',
isactive TINYINT(1) DEFAULT 1,
createdat DATETIME DEFAULT CURRENTTIMESTAMP,
PRIMARY KEY (packageid),
KEY idxproviderid (providerid),
KEY idxexternalid (externalid),
KEY idxpackagetype (packagetype),
KEY idxisactive (isactive)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4unicodeci;
Transaction Type Reference
Transaction Status Reference
Config Variables
From ct/dat/config.inc.php:
$dbhost,$dbuser,$dbpasswd,$db- Database connection
File Dependencies
ct/includes/sessions.inc.php - Session managementct/dat/config.inc.php - Configurationct/includes/header.php - Admin header
ct/includes/annotateftr.php- Admin footer- Font Awesome 5+ - Icon library
Features & UI Elements
Page Header
[Screenshot: billing-transactions-header]
The page header displays:
- Title: "Billing Transactions"
- Icon:
fa-exchange-alt(exchange icon) - Breadcrumb: Dashboard / Billing / Transactions
Statistics Dashboard
[Screenshot: billing-transactions-stats]
Seven statistics cards showing transaction overview:
Filter Panel
[Screenshot: billing-transactions-filters]
A collapsible filter panel with:
Action Buttons:
- Apply Filters (Green) - Apply selected filters
- Clear Filters - Reset all filters to default
Transactions Table
[Screenshot: billing-transactions-table]
A data table showing all transactions:
Type Badges:
Status Badges:
Transaction Detail Modal
[Screenshot: billing-transaction-modal]
When clicking "View Details", a modal displays:
Basic Information:
- Transaction ID
- User (with link to profile)
- Provider name
- External Package ID
- Type and Status
- Amount with currency
Subscription Details:
- Access Start Date
- Access End Date
- Subscription ID (for recurring)
- Parent Transaction (for rebills/refunds)
Technical Details:
- IP Address
- User Agent
- Notes (if any)
- Created Date
- Updated Date
Pagination
- 50 transactions per page
- Previous/Next navigation
- Page number links
- Maintains filter parameters across pages
Step-by-Step Usage
Viewing All Transactions
- Navigate to Admin Panel → Billing → Transactions
- The page loads with all transactions (newest first)
- Browse transactions in the table
- Click on a transaction row for details
Filtering Transactions
By Provider:
- Expand the filter panel (if collapsed)
- Select a provider from the Provider dropdown
- Click Apply Filters
- Only transactions from that provider are shown
By Type:
- Select a transaction type from the Type dropdown
- Click Apply Filters
- Only matching transaction types are shown
By Status:
- Select a status from the Status dropdown
- Click Apply Filters
- Only transactions with that status are shown
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 transactions within the range are shown
Combining Filters:
- Select multiple filter criteria
- Click Apply Filters
- Results match ALL selected criteria (AND logic)
Searching Transactions
- Enter a search term in the Search field
- Click Apply Filters
- Matches against:
- Username
- External transaction ID
- Subscription ID
Viewing Transaction Details
- Find the transaction in the table
- Click the View button (eye icon)
- Modal opens with full transaction details
- Review all fields including technical data
- Click outside modal or press ESC to close
Tracking Subscription Lifecycle
- Find an initial purchase transaction
- Note the Subscription ID
- Search for that subscription ID
- View all related transactions:
- Initial purchase
- Rebills (monthly charges)
- Any refunds or chargebacks
Investigating Chargebacks
- Filter by Type: Chargeback
- Review chargeback transactions
- Click to view details
- Note the user and external ID
- Click username to view user profile
- Check user's transaction history for patterns
Exporting Transaction Data
The current implementation displays data on-screen. For exports:
- Use the filter options to narrow results
- Use browser print function (Ctrl+P)
- Or query database directly for CSV exports
Best Practices
Revenue Monitoring
- Daily Check:
- Review total transactions from last 24 hours
- Check for unusual chargeback spikes
- Verify rebills are processing correctly
- Weekly Review:
- Compare revenue week-over-week
- Analyze refund rates by provider
- Check conversion rates
- Monthly Analysis:
- Full revenue reconciliation
- Provider performance comparison
- Customer lifetime value tracking
Chargeback Management
Steps for High Chargebacks:
- Identify repeat chargeback users
- Review their transaction history
- Consider account suspension
- Document all evidence
- Respond to provider within deadlines
Transaction Reconciliation
- Match with Provider Dashboard:
- Export transactions for date range
- Compare counts with provider reports
- Identify any discrepancies
- Verify Revenue Totals:
- Sum transactions by status
- Exclude cancelled/voided
- Match with bank deposits
Troubleshooting
Common Issues
Transactions Not Appearing
Cause: Webhook not received or processed
Solutions:
- Check billing logs for webhook errors
- Verify provider webhook URL is correct
- Check server firewall for blocked requests
- Verify transaction exists in provider dashboard
- Manually check
tblBillingTransactionstable
User Not Linked to Transaction
Cause: User not logged in during purchase or webhook timing
Solutions:
- Check if
useridis NULL in database - Review webhook payload for user identifier
- Manually link transaction if user is identified:
UPDATE tblBillingTransactions
SET userid = {correctuserid}
WHERE transactionid = {transactionid};
Incorrect Transaction Type
Cause: Provider sent wrong transaction classification
Solutions:
- Review original webhook payload in billing logs
- Manually update if needed:
UPDATE tblBillingTransactions
SET typeid = {correcttypeid}
WHERE transactionid = {transactionid};
Missing Rebills
Cause: Subscription cancelled or rebill webhook failed
Solutions:
- Check provider dashboard for rebill status
- Verify subscription is still active
- Check billing logs for failed webhooks
- Contact provider if discrepancy exists
Database Issues
Missing Provider
Cause: Provider deleted but transactions reference it
Solution:
-- Find orphaned transactions
SELECT transactionid, internalproviderid
FROM tblBillingTransactions
WHERE internalproviderid NOT IN (
SELECT internalproviderid FROM tblPaymentProviders
);
-- Re-add provider or update transactions
Date Range Issues
Cause: Timezone mismatch between server and database
Solution:
- Verify PHP timezone setting
- Check MySQL timezone:
SELECT @@global.timezone, @@session.timezone;
- Ensure consistency across all systems
Security Considerations
Access Control
- Only administrators can view transaction data
- Session validation on page load
- CSRF protection on all form submissions
Sensitive Data
- Never share external transaction IDs publicly
- IP addresses are logged for fraud prevention
- User agents help identify suspicious patterns
- Limit access to billing section to trusted admins
Audit Trail
All transaction changes should be logged:
- Transaction creation (automatic)
- Status changes
- Manual updates (document in notes field)
Translatable Strings
{
"billingtransactionstitle": "Billing Transactions",
"billingtransactionsbreadcrumb": "Dashboard / Billing / Transactions",
"billingstattotal": "Total Transactions",
"billingstatinitial": "Initial Purchases",
"billingstatrebills": "Rebills",
"billingstatchargebacks": "Chargebacks",
"billingstatrefunds": "Refunds",
"billingstatrevenue": "Total Revenue",
"billingstatrefunded": "Total Refunded",
"billingfiltersearch": "Search username or external ID",
"billingfilterprovider": "All Providers",
"billingfiltertype": "All Types",
"billingfilterstatus": "All Statuses",
"billingfilterdatefrom": "Date From",
"billingfilterdateto": "Date To",
"billingfilterapply": "Apply Filters",
"billingfilterclear": "Clear Filters",
"billingtableid": "ID",
"billingtableuser": "User",
"billingtableprovider": "Provider",
"billingtablepackage": "Package",
"billingtabletype": "Type",
"billingtablestatus": "Status",
"billingtableamount": "Amount",
"billingtableexternalid": "External ID",
"billingtableaccessperiod": "Access Period",
"billingtablecreated": "Created",
"billingtableactions": "Actions",
"billingtypeinitial": "Initial Purchase",
"billingtypeconversion": "Conversion",
"billingtyperebill": "Rebill",
"billingtypechargeback": "Chargeback",
"billingtyperefund": "Refund",
"billingtypevoid": "Void",
"billingtypetokens": "Tokens",
"billingstatusopen": "Open",
"billingstatusclosed": "Closed",
"billingstatuscancelled": "Cancelled",
"billingmodaltitle": "Transaction Details",
"billingmodaluser": "User",
"billingmodalprovider": "Provider",
"billingmodalpackage": "Package",
"billingmodaltype": "Type",
"billingmodalstatus": "Status",
"billingmodalamount": "Amount",
"billingmodalexternalid": "External ID",
"billingmodalsubscriptionid": "Subscription ID",
"billingmodalparenttransaction": "Parent Transaction",
"billingmodalaccessstart": "Access Start",
"billingmodalaccessend": "Access End",
"billingmodalipaddress": "IP Address",
"billingmodaluseragent": "User Agent",
"billingmodalnotes": "Notes",
"billingmodalcreated": "Created",
"billingmodalupdated": "Updated",
"billingmodalclose": "Close",
"billingnotransactions": "No transactions found",
"billingnomatching": "No transactions match your filters",
"billingguestuser": "Guest User",
"billingunknownprovider": "Unknown Provider",
"billingviewuser": "View User Profile",
"billingviewdetails": "View Details"
}
Related Documentation
- Payment Providers - Payment provider configuration
- Access Packages - Subscription package management
- Billing Logs - Payment processor logs
- User Management - User account management