Track billing events in PHP

Learn how to use Operational to track billing events in your PHP app for invoice creation, payments, and failures.

What is billing event tracking in PHP

Tracking billing events helps you monitor payments and invoices in your PHP application. It gives you real-time insight into customer transactions.

For example, you can log when an invoice is generated, when a payment succeeds, and when a payment fails. This helps troubleshoot issues quickly.

What is Operational

Operational is an open-source tool for tracking events in any tech product. You can send billing events from your PHP backend to Operational and view them in a clean UI.

Setting up Operational

  1. Go to https://app.operational.co and sign up for a free account.
  2. Create a new project and copy your API key.
  3. Install the PHP SDK by running:
    composer require operational/operational-php
  4. Configure your project with the API key:
    require 'vendor/autoload.php';
    
    $ops = new Operational('YOUR_API_KEY');

Tracking billing events in PHP

<?php
require 'vendor/autoload.php';

$ops = new Operational('YOUR_API_KEY');

$payload = [
  'name' => 'billing_success',
  'avatar' => '💳',
  'content' => 'Invoice #12345 paid successfully by John Doe for $49.99'
];

$ops->events->ingest($payload);

This code sends a billing success event to Operational with details on invoice number, payer, and amount.

Conclusion

Operational helps you track billing events in PHP without building a custom system. It saves time and reduces errors in monitoring payments.

Learn more at https://operational.co. Try it out in the playground: https://operational.co/playground