Testing WHMCS

From WHMCS Documentation

We recommend that you follow the below steps to test your WHMCS installation and then reset it for production use before you make it available to your customers.

Testing Modules

When possible, WHMCS-shipped registrar and gateway modules come with a test mode or the ability to use a test environment to test transactions and domain orders. For details on enabling test mode, see the relevant module's documentation (for example, Enom's documentation).

For example, enabling test mode in the eNom module resembles this example:

Enom-test-mode.png

Testing provisioning modules does not require a test mode. However, make certain that you are able to reverse all of the actions that you perform, both to restore the system to its original state and to test more functionality. For example, you could provision a cPanel account on a remote server and then use the Terminate module command to remove it.

Disabling Outgoing Emails

We added this feature in WHMCS 8.1.

Disable Email Toggle
When testing, it is usually ideal to prevent WHMCS from sending emails (unless the test is specific to receiving emails).

To do this in WHMCS 8.1 and later:

  1. Go to the Mail tab at Configuration () > System Settings > General Settings.
  2. Toggle Disable Email Sending to On.

Placing Orders

After you configure your required modules in test mode, place some test orders.

To place test orders in the Admin Area:

  1. Create a client account using the process in Manually Adding a Client.
    • If you have PHP experience, you can also add clients using the AddClient API.
    • Make certain to configure the relevant domain or product pricing before proceeding with testing orders. For more information, see Domain Pricing and Products and Services.
      Admin Order Form
  2. Create multiple test orders. For example, to place an order for a domain registration:
    1. In a client's profile's Summary tab, click Add New Order in the "Actions" panel.
    2. Fill out the displayed form, beginning with choosing the payment gateway you want the client's future invoices to use.
    3. Select None from the Product/Service menu.
    4. Select Monthly from the Billing Cycle menu for the product section.
    5. Enter the domain for Domain and select "Register" for Domain Registration.
    6. Choose the number of years you want to invoice the client for at the time of renewal.

You can also place an order by clicking Login as Owner in the client's profile's Summary tab. This allows you to see the workflow a customer would see.

WHMCS will only ever trigger a registration request for a domain name when the client pays the invoice. For information about how WHMCS handles this for products, see Module Settings.

Processing Transactions

To test payment on an invoice, check our module documentation and follow the necessary process for the gateway module you are using.

For example, PayPal Checkout requires you to log in as a client and pay from the Client Area by selecting the invoice itself, while Stripe requires you to capture payment against a stored card or pay method. For more information, see Pay Methods.

Checking Automation

Gateway Log

You can find details on payments that the system has processed against an invoice at Billing > Gateway Log. The log will list the results and other data to allow you to validate success.

For domain registrars and provisioning modules, the Activity Log at Configuration () > System Logs or, prior to WHMCS 8.0, Utilities > Logs will record success or failure of the associated automation actions. This log also records details from the invoice's payment, like the addition of the transaction.

If automation encounters any errors, the Module Debug Log will report the sent request and received response, allowing you to determine the issue and resolve it.

Resetting Your Database

After you successfully test your WHMCS configuration, you may want to reset it in order to remove the test accounts, orders, invoices, and other items that you created.

You can empty all of the tables that contain client data by running the following SQL code on your database:

TRUNCATE `mod_invoicedata` ;
TRUNCATE `tblinvoicedata` ;
TRUNCATE `tblaccounts` ;
TRUNCATE `tblactivitylog` ;
TRUNCATE `tblaffiliates` ;
TRUNCATE `tblaffiliatesaccounts` ;
TRUNCATE `tblaffiliateshistory` ;
TRUNCATE `tblaffiliatespending` ;
TRUNCATE `tblaffiliateswithdrawals` ;
TRUNCATE `tblbankaccts`;
TRUNCATE `tblbillableitems` ;
TRUNCATE `tblcancelrequests` ;
TRUNCATE `tblclients` ;
TRUNCATE `tblclientsfiles` ;
TRUNCATE `tblcontacts` ;
TRUNCATE `tblcredit` ;
TRUNCATE `tblcreditcards`;
TRUNCATE `tblcustomfieldsvalues` ;
TRUNCATE `tbldomains` ;
TRUNCATE `tbldomainsadditionalfields` ;
TRUNCATE `tblemails` ;
TRUNCATE `tblhosting` ;
TRUNCATE `tblhostingaddons` ;
TRUNCATE `tblhostingconfigoptions` ;
TRUNCATE `tblinvoiceitems` ;
TRUNCATE `tblinvoices` ;
TRUNCATE `tblmodulequeue` ;
TRUNCATE `tblnotes` ;
TRUNCATE `tblorders` ;
TRUNCATE `tblpaymethods`;
TRUNCATE `tblquotes` ;
TRUNCATE `tblquoteitems` ;
TRUNCATE `tblsslorders` ;
TRUNCATE `tblticketlog` ;
TRUNCATE `tblticketnotes` ;
TRUNCATE `tblticketreplies` ;
TRUNCATE `tbltickets` ;
TRUNCATE `tbltodolist` ;
TRUNCATE `tbltransaction_history` ;
TRUNCATE `tblupgrades` ;
TRUNCATE `tblusers`;
TRUNCATE `tblusers_clients`;
TRUNCATE `tbluser_invites`;

Resetting your database only deletes client accounts and information. You will not lose any configuration or product settings.

Storage Settings and Test Environments

When you use local storage locations and are switching between development (test) or live environments, it's important to update your storage settings. If the configured storage locations do not exist on your server, certain features (such as sending emails) may not function correctly.

Amazon S3™ storage locations must have the required access credentials in order to function.

For more information, see Migrating Between Storage Locations.