Skip to content
2E0JWR
PBNPorkbun for WHMCS

Installing the module

Upload the module to modules/registrars/porkbun, activate it in WHMCS, enter your API keys, set default nameservers and assign it to your TLDs.

Ten minutes, most of it waiting for an upload.

1. Upload the files

Copy the porkbun folder into your WHMCS installation at /path-to-whmcs/modules/registrars/porkbun/. The finished layout:

modules/registrars/porkbun/
├── porkbun.php               the registrar module itself
├── hooks.php                 schedules the daily pricing sync
├── webhook.php               webhook receiver + setup CLI
├── pricing.php               pricing sync CLI
├── README.md
└── lib/
    ├── PorkbunApi.php        API client
    ├── PorkbunPricing.php    cost prices and markup rules
    └── PorkbunPricingSync.php  writes prices into WHMCS

Upload all of it in one go. porkbun.php requires the two pricing files at load time, so a partial upload where porkbun.php arrives before lib/ will throw a fatal error on every registrar operation until the rest lands. If you are upgrading a live install, upload to a temporary directory and move it into place, or upload the whole folder as a single archive.

2. Activate it

Configuration → System Settings → Domain Registrars

Find Porkbun in the list and click Activate, then Configure.

3. Enter your API keys

Paste in your API Key (pk1_…) and Secret API Key (sk1_…) from porkbun.com/account/api, then save.

Saving validates them against Porkbun. If the credentials are wrong, the save is refused with an explanation rather than silently accepted — so a successful save means the keys work.

Start with a sandbox key (pk1_sb_…) if you want to test the full flow first. It uses the same host and the same endpoints against an isolated environment with fake credit.

4. Set your default nameservers

The four nameserver fields are pre-filled with Porkbun’s own:

curitiba.ns.porkbun.com
fortaleza.ns.porkbun.com
maceio.ns.porkbun.com
salvador.ns.porkbun.com

Left as they are, new domains use Porkbun-hosted DNS, and you or your customer manage records from the DNS tab in WHMCS. Replace all four with your own nameservers if you host DNS elsewhere — in that case the WHMCS DNS tab will not be the right place to manage records, because the domain will not be using Porkbun’s DNS.

Customers can still change their nameservers to anything they like from the domain’s Nameservers page at any time.

5. Assign it to your TLDs

Configuration → System Settings → Domain Pricing

Set the Auto Registration column to Porkbun for each TLD you want it to handle. Only TLDs assigned here will use the module.

6. Set up pricing

Covered separately in Automatic pricing. In short: either run WHMCS’s Import Pricing wizard to pull Porkbun’s cost prices in once, or configure the markup rules and let the module write retail prices nightly.

7. Optional: webhooks

Worth doing. Without them, WHMCS only learns about a completed transfer when the domain sync cron next runs, so an overnight transfer can leave a customer looking at Pending Transfer for most of a day. See Webhooks.

Upgrading an existing install

The module has no database tables of its own beyond the webhook deduplication table, which is created automatically, and no migrations. Replacing the files is the whole upgrade.

Two things to do afterwards:

  1. Open the registrar config and click Save Changes, even if you change nothing. WHMCS only scans a module directory for hooks.php when the module is activated or saved, so the daily pricing sync will not be registered until you do. Saving also persists the default values of any new settings.
  2. Keep a copy of the previous porkbun.php and lib/PorkbunApi.php. Dropping them back is a clean rollback; there is no database state to unwind.