Command line reference
The two command line scripts in full: pricing.php for previewing and applying retail prices, and webhook.php for registering, listing, testing and disabling endpoints.
Two CLI scripts, both run from the module directory:
cd /path-to-whmcs/modules/registrars/porkbunBoth read your API credentials from the registrar configuration in WHMCS, so there is nothing to pass in and no credentials on the command line.
pricing.php
Turns Porkbun’s cost prices into your retail prices and writes them into WHMCS Domain Pricing.
php pricing.php preview every change, write nothing
php pricing.php --apply write the changes
php pricing.php --tld=.com,.dev limit the run to these extensions
php pricing.php --all list unchanged and skipped TLDs too
php pricing.php --helpA run without --apply is read-only. It calls Porkbun and reads WHMCS, and that is all. Nothing is written, no prices change.
Reading the output
Preview (nothing written) — prices in GBP, converted from USD at 0.79
Terms: 1 year only (years 2-10 switched off)
TLD ACTION COST (reg/renew/xfer) RETAIL (reg/renew/xfer) NOTE
-----------------------------------------------------------------------------------
.com update 8.75 / 8.75 / 8.75 11.99 / 11.99 / 11.99
.co.uk update 3.41 / 4.47 / 0.00 5.99 / 6.99 / -
.app create 6.91 / 11.79 / 11.79 9.99 / 15.99 / 15.99
.net skip - / - / - - / - / - assigned to the enom registrar in WHMCS
5 TLDs examined, 3 would change (GBP, dry run).
Re-run with --apply to write these prices.The header lines matter as much as the table. The first confirms the currency and, if converting, the rate. The second says whether you are about to switch years 2–10 off.
Actions:
| Action | Meaning |
|---|---|
create | The TLD is not in WHMCS Domain Pricing and will be added, assigned to Porkbun |
update | The TLD exists and its prices will be overwritten |
skip | Nothing will be done. The note says why |
failed | WHMCS rejected the write. The note carries the error |
A dash in the price columns means no figure — either Porkbun quotes none, or a skip rule applies.
Exit codes
0 on success, 1 if anything failed — so it can be used in a scripted deployment.
Typical uses
# see what a markup change would do before saving it
php pricing.php
# apply, but only to the TLDs you are sure about
php pricing.php --tld=.com,.net,.org --apply
# audit: show everything, including what is being skipped and why
php pricing.php --allwebhook.php
Sets up and inspects the Porkbun webhook endpoint. The same file also serves as the HTTP receiver when Porkbun POSTs to it.
php webhook.php --register <https url> create or reuse an endpoint, print its secret
php webhook.php --list show endpoints, subscriptions and health
php webhook.php --test [id] send a webhook.test event
php webhook.php --disable <id> pause deliveries to an endpoint--register
php webhook.php --register https://billing.example.com/modules/registrars/porkbun/webhook.phpPrints the signing secret to paste into Webhook Signing Secret on the registrar configuration page.
Safe to re-run: it reuses an endpoint already pointing at that URL, and re-enables it if Porkbun had disabled it after repeated delivery failures.
The URL must be https:// on port 443 and resolve to a public address. Porkbun re-checks this before every delivery, not just at registration.
--list
Shows every endpoint on the account with its subscriptions and status. This is where you find out an endpoint has been disabled after 20 consecutive failures.
--test
Sends a webhook.test event. Check Configuration → System Logs → Module Log for a Webhook Test entry to confirm the round trip.
--disable
Pauses deliveries without deleting the endpoint.
Running from cron
Neither script needs to be scheduled manually.
- The pricing sync runs on the WHMCS daily cron once Sync retail pricing daily is ticked. That is
hooks.phpdoing the work, not a separate cron entry. - Webhooks are pushed by Porkbun; there is nothing to poll.
If you prefer an explicit cron entry for pricing instead of the WHMCS hook, leave the setting off and schedule it yourself:
0 4 * * * /usr/bin/php /path-to-whmcs/modules/registrars/porkbun/pricing.php --apply >/dev/null