Difference between revisions of "Testing WHMCS"
Line 1: | Line 1: | ||
− | + | 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== | ==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, [https://docs.whmcs.com/Enom#Test_Mode Enom's documentation]). | |
+ | |||
+ | For example, enabling test mode in the eNom module resembles this example: | ||
[[File:Enom-test-mode.png|800px]] | [[File:Enom-test-mode.png|800px]] | ||
− | + | 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== | ==Disabling Outgoing Emails== | ||
− | |||
<div class="docs-alert-info"> | <div class="docs-alert-info"> | ||
− | + | We added this feature in WHMCS 8.1. | |
</div> | </div> | ||
+ | |||
+ | [[File:disable-emails.png|200px|thumb|right|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: | ||
+ | |||
+ | # Go to the '''[[Mail Tab|Mail]]''' tab at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings'''. | ||
+ | # Toggle '''Disable Email Sending''' to '''On'''. | ||
==Placing Orders== | ==Placing Orders== | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | After you configure your required modules in test mode, place some test orders. | |
− | + | ||
+ | To place test orders in the [[Admin Area]]: | ||
+ | |||
+ | # Create a client account using the process in [https://help.whmcs.com/m/installation/l/682009-manually-adding-a-client/ Manually Adding a Client]. | ||
+ | #* If you have PHP experience, you can also add clients using the <tt>[https://developers.whmcs.com/api-reference/addclient AddClient]</tt> 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]].[[File:Admin_order_form.png|200px|thumb|right|Admin Order Form]] | ||
+ | # Create multiple test orders. For example, to place an order for a domain registration: | ||
+ | ## In a client's profile's '''[[Clients:Summary Tab|Summary]]''' tab, click '''Add New Order''' in the "Actions" panel. | ||
+ | ## Fill out the displayed form, beginning with choosing the payment gateway you want the client's future invoices to use. | ||
+ | ## Select ''None'' from the '''Product/Service''' menu. | ||
+ | ## Select ''Monthly'' from the '''Billing Cycle''' menu for the product section. | ||
+ | ## Enter the domain for '''Domain''' and select "Register" for '''Domain Registration'''. | ||
+ | ## 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 '''[[Clients:Summary Tab|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 [[Products_and_Services#Module_Settings|Module Settings]]. | ||
==Processing Transactions== | ==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== | ==Checking Automation== | ||
+ | |||
[[File:gateway_log_example.png|200px|thumb|right|Gateway Log]] | [[File:gateway_log_example.png|200px|thumb|right|Gateway Log]] | ||
− | |||
− | + | You can find details on payments that the system has processed against an invoice in the '''[[Gateway Log]]''' at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > [[System Logs]]''' or, prior to WHMCS 8.0, '''Utilities > Logs'''. 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 (<i class="fa fa-wrench" aria-hidden="true"></i>) > [[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 '''[[Troubleshooting_Module_Problems|Module Debug Log]]''' will report the sent request and received response, allowing you to determine the issue and resolve it. | ||
==Resetting Your Database== | ==Resetting Your Database== | ||
− | |||
− | You can empty all the tables that contain | + | 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: | ||
<div class="source-cli"> | <div class="source-cli"> | ||
Line 97: | Line 114: | ||
<div class="docs-alert-warning"> | <div class="docs-alert-warning"> | ||
− | |||
Resetting your database only deletes client accounts and information. You will not lose any configuration or product settings. | Resetting your database only deletes client accounts and information. You will not lose any configuration or product settings. | ||
</div> | </div> | ||
Line 103: | Line 119: | ||
===Storage Settings and Test Environments=== | ===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 | + | 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. |
For more information, see [[Moving Storage Locations]]. | For more information, see [[Moving Storage Locations]]. |
Revision as of 18:09, 9 May 2022
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.
Contents
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:
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.
To do this in WHMCS 8.1 and later:
- Go to the Mail tab at Configuration () > System Settings > General Settings.
- 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:
- 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.
- Create multiple test orders. For example, to place an order for a domain registration:
- In a client's profile's Summary tab, click Add New Order in the "Actions" panel.
- Fill out the displayed form, beginning with choosing the payment gateway you want the client's future invoices to use.
- Select None from the Product/Service menu.
- Select Monthly from the Billing Cycle menu for the product section.
- Enter the domain for Domain and select "Register" for Domain Registration.
- 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
You can find details on payments that the system has processed against an invoice in the Gateway Log at Configuration () > System Logs or, prior to WHMCS 8.0, Utilities > Logs. 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 `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.
For more information, see Moving Storage Locations.