Artisan commands
The command-line tools that ship with Tidemark Billing, what each does, its options and when the scheduler runs it for you.
Tidemark Billing includes commands you run with php artisan from the application folder on the server. Most of them run by themselves from the scheduler; you run the others by hand for installs, recovery and maintenance. To see everything installed, run php artisan list and look under api, billing, plugin and tickets.
cd /path/to/billing
php artisan billing:run
What the scheduler runs#
You add one cron job that runs php artisan schedule:run every minute. It then starts:
| Command | When |
|---|---|
billing:run |
Daily at 02:30 |
billing:autopay |
Hourly |
queue:work --stop-when-empty --max-time=50 --tries=3 |
Every minute, unless BILLING_EXTERNAL_WORKER is set or the queue connection is sync |
tickets:fetch |
Every minute, only while support tickets are switched on |
On hosts with no command-line cron, a request to /cron/{token} every minute runs the same scheduler. The token is BILLING_CRON_TOKEN, or the one set in the admin area.
Billing#
billing:run#
Runs the daily billing tasks and prints a count for each:
usage pulled, plan changes, trial reminders, invoices (renewal invoices), reminders, suspended, terminated, cancelled, quotes expired and provisioning retried.
It is safe to run by hand, for example to see what a settings change does without waiting for 02:30. See Recurring billing and Emails and reminders.
billing:autopay#
Charges saved payment methods for invoices that are due and retries failed automatic payments. It prints checked, paid, failed, action required and pending. See Payments and refunds.
billing:usage:pull#
Asks provisioning modules that can report consumption for the usage of every live service whose product has meters, and prints usage records stored. billing:run already includes this step, so you only need it on its own for testing. See Usage-based billing.
Install and recovery#
billing:install#
Runs migrations and creates the first administrator without the web installer. Useful for Docker and scripts.
php artisan billing:install --name="Jane Example" [email protected] \
--company="Example Ltd" --currency=USD --plugin=stripe
| Option | Environment variable | Default |
|---|---|---|
--name |
BILLING_ADMIN_NAME |
Administrator |
--email (required) |
BILLING_ADMIN_EMAIL |
none |
--password (required) |
BILLING_ADMIN_PASSWORD |
none |
--company |
BILLING_COMPANY |
the application name |
--currency |
BILLING_CURRENCY |
USD |
--plugin= |
none | none; repeat it to enable several plugins |
If the installation is already done it prints "Already installed." and changes nothing. Prefer the environment variables over --password so the password does not land in your shell history. See Install with Docker.
billing:reset-2fa#
Turns off two-factor authentication for a user who lost their phone and recovery codes.
php artisan billing:reset-2fa [email protected] --revoke-tokens
They can then sign in with their password and set it up again. --revoke-tokens also revokes all of that user's API tokens. The reset is written to the activity log. See Two-factor sign-in.
Plugins#
plugin#
php artisan plugin list
php artisan plugin install /path/to/plugin.zip
php artisan plugin enable acme-widgets
php artisan plugin disable acme-widgets
php artisan plugin remove acme-widgets --drop-settings --force
list shows slug, name, version, whether it is enabled and where it came from. install takes a zip path or an https URL, asks before replacing an installed plugin (--force skips the question) and leaves a new plugin disabled. remove deletes an uploaded plugin's files after confirmation. Installing runs code you did not write, so only install plugins you trust. See Plugins.
Support tickets#
tickets:fetch#
Pulls new support email from the IMAP mailboxes of departments that have IMAP enabled and turns it into tickets and replies. It prints how many messages each department processed. It does nothing while support tickets are off. --department=slug limits it to one department. Normally the scheduler runs it.
tickets:pipe#
Creates a ticket or a reply from one raw email read on standard input, for mail servers that can pipe incoming mail to a program.
php artisan tickets:pipe --department=support < message.eml
Without --department, the recipient addresses decide the department. It exits with 67 for an unknown department or recipient and 75 for a temporary failure (including support being switched off), the codes mail servers expect to bounce or retry. See Departments and email in.
PDFs and the API spec#
billing:fonts:install#
Downloads optional font packs so PDFs can show Chinese, Japanese and Korean text. The packs are sc, tc, jp and kr.
php artisan billing:fonts:install --pack=jp --pack=kr
php artisan billing:fonts:install --remove
With no --pack it installs sc, jp and kr. With --remove and no --pack it removes all packs. This command needs a network connection to download the fonts. See PDF and fonts.
api:openapi#
Regenerates resources/openapi.json, the spec behind /api/v1/openapi.json. --check writes nothing and fails if the file is out of date; --path= writes elsewhere. This is for people changing the code. The released file is already current. See REST API.