What is billing event tracking in WooCommerce?
Tracking billing events helps you monitor payment flows in your store.
You can see when invoices are created, paid, or fail.
For example, you might want to alert your team when a payment fails to follow up.
Using Operational for billing events
Operational lets you send and view events in a dashboard.
You can record all billing steps and search or filter them easily.
Setting up Operational
- Go to app.operational.co
- Sign up for an account or log in
- In the dashboard, go to Settings and create a new API key
- Copy your API key for use in your code
PHP code examples for billing events
<?php
$opsKey = 'YOUR_API_KEY';
$payload = [
'name' => 'invoice paid',
'avatar' => '💰',
'content' => 'Invoice #123 paid by John Smith for $49.99'
];
$ch = curl_init('https://events.operational.co/v1');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $opsKey,
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
This code sends an “invoice paid” event to Operational.
// Tracking a failed invoice
$payload['name'] = 'invoice failed';
$payload['avatar'] = '❌';
$payload['content'] = 'Invoice #124 failed for Jane Doe due to payment error';
// send as above
// Tracking a new invoice creation
$payload['name'] = 'invoice created';
$payload['avatar'] = '🧾';
$payload['content'] = 'Invoice #125 created for Acme Corp for $199.00';
// send as above
Conclusion
Operational saves time by handling event storage and search for you.
You focus on billing logic and let Operational show live events.
Learn more at https://operational.co.
Try the playground to copy and paste snippets: https://operational.co/playground.