├── README.md ├── about ├── contribute.md ├── faq.md ├── index.md └── quick-start.md ├── addon-modules ├── admin-area-output.md ├── admin-dashboard-widgets.md ├── client-area-output.md ├── configuration.md ├── getting-started.md ├── hooks.md ├── index.md ├── installation-uninstallation.md ├── multi-language.md ├── upgrades.md └── whmcs-marketplace.md ├── advanced ├── admin-area.md ├── authentication.md ├── creating-pages.md ├── currency-formatting.md ├── date-functions.md ├── db-interaction.md ├── index.md ├── json-file.md ├── logging.md ├── module-image-placeholder.png ├── sample-widget-output.png ├── upgrade-to-whmcs-8.md └── widgets.md ├── api-reference ├── acceptorder.md ├── acceptquote.md ├── activatemodule.md ├── addannouncement.md ├── addbannedip.md ├── addbillableitem.md ├── addcancelrequest.md ├── addclient.md ├── addclientnote.md ├── addcontact.md ├── addcredit.md ├── addinvoicepayment.md ├── addorder.md ├── addpaymethod.md ├── addproduct.md ├── addprojectmessage.md ├── addprojecttask.md ├── addticketnote.md ├── addticketreply.md ├── addtransaction.md ├── adduser.md ├── affiliateactivate.md ├── applycredit.md ├── blockticketsender.md ├── cancelorder.md ├── capturepayment.md ├── closeclient.md ├── createclientinvite.md ├── createinvoice.md ├── createoauthcredential.md ├── createorupdatetld.md ├── createproject.md ├── createquote.md ├── createssotoken.md ├── deactivatemodule.md ├── decryptpassword.md ├── deleteannouncement.md ├── deleteclient.md ├── deletecontact.md ├── deleteoauthcredential.md ├── deleteorder.md ├── deletepaymethod.md ├── deleteprojecttask.md ├── deletequote.md ├── deleteticket.md ├── deleteticketnote.md ├── deleteticketreply.md ├── deleteuserclient.md ├── domaingetlockingstatus.md ├── domaingetnameservers.md ├── domaingetwhoisinfo.md ├── domainregister.md ├── domainrelease.md ├── domainrenew.md ├── domainrequestepp.md ├── domaintoggleidprotect.md ├── domaintransfer.md ├── domainupdatelockingstatus.md ├── domainupdatenameservers.md ├── domainupdatewhoisinfo.md ├── domainwhois.md ├── encryptpassword.md ├── endtasktimer.md ├── fraudorder.md ├── geninvoices.md ├── getactivitylog.md ├── getadmindetails.md ├── getadminusers.md ├── getaffiliates.md ├── getannouncements.md ├── getautomationlog.md ├── getcancelledpackages.md ├── getclientgroups.md ├── getclientpassword.md ├── getclients.md ├── getclientsaddons.md ├── getclientsdetails.md ├── getclientsdomains.md ├── getclientsproducts.md ├── getconfigurationvalue.md ├── getcontacts.md ├── getcredits.md ├── getcurrencies.md ├── getemails.md ├── getemailtemplates.md ├── gethealthstatus.md ├── getinvoice.md ├── getinvoices.md ├── getmoduleconfigurationparameters.md ├── getmodulequeue.md ├── getorders.md ├── getorderstatuses.md ├── getpaymentmethods.md ├── getpaymethods.md ├── getpermissionslist.md ├── getproducts.md ├── getproject.md ├── getprojects.md ├── getpromotions.md ├── getquotes.md ├── getregistrars.md ├── getservers.md ├── getstaffonline.md ├── getstats.md ├── getsupportdepartments.md ├── getsupportstatuses.md ├── getticket.md ├── getticketattachment.md ├── getticketcounts.md ├── getticketnotes.md ├── getticketpredefinedcats.md ├── getticketpredefinedreplies.md ├── gettickets.md ├── gettldpricing.md ├── gettodoitems.md ├── gettodoitemstatuses.md ├── gettransactions.md ├── getuserpermissions.md ├── getusers.md ├── index.md ├── listoauthcredentials.md ├── logactivity.md ├── mergeticket.md ├── modulechangepackage.md ├── modulechangepw.md ├── modulecreate.md ├── modulecustom.md ├── modulesuspend.md ├── moduleterminate.md ├── moduleunsuspend.md ├── openticket.md ├── orderfraudcheck.md ├── pendingorder.md ├── resetpassword.md ├── sendadminemail.md ├── sendemail.md ├── sendquote.md ├── setconfigurationvalue.md ├── starttasktimer.md ├── triggernotificationevent.md ├── updateadminnotes.md ├── updateannouncement.md ├── updateclient.md ├── updateclientaddon.md ├── updateclientdomain.md ├── updateclientproduct.md ├── updatecontact.md ├── updateinvoice.md ├── updatemoduleconfiguration.md ├── updateoauthcredential.md ├── updatepaymethod.md ├── updateproject.md ├── updateprojecttask.md ├── updatequote.md ├── updateticket.md ├── updateticketreply.md ├── updatetodoitem.md ├── updatetransaction.md ├── updateuser.md ├── updateuserpermissions.md ├── upgradeproduct.md ├── validatelogin.md └── whmcsdetails.md ├── api ├── access-control.md ├── api-index.md ├── authentication.md ├── getting-started.md ├── index.md ├── internal-api.md ├── response-types.md └── sample-code.md ├── classes-reference └── index.md ├── domain-registrars ├── availability-checks.md ├── client-area-output.md ├── config-options.md ├── domain-information.md ├── domain-syncing.md ├── extending-further.md ├── function-index.md ├── getting-started.md ├── hooks.md ├── index.md ├── metadata-params.md ├── module-functions.md ├── module-logging.md ├── module-parameters.md ├── premium-domains.md ├── tld-pricing-sync.md └── transfer-policy-management.md ├── hooks-reference ├── addon.md ├── admin-area.md ├── authentication.md ├── client-area-interface.md ├── client.md ├── contact.md ├── cron.md ├── domain.md ├── everything-else.md ├── index.md ├── invoices-and-quotes.md ├── module.md ├── output.md ├── products-and-services.md ├── registrar-module.md ├── service.md ├── shopping-cart.md ├── support-tools.md ├── ticket.md └── user.md ├── hooks ├── getting-started.md ├── hook-index.md ├── index.md ├── module-hooks.md ├── priority.md └── sample-hook.md ├── intro ├── index.md └── overview.md ├── languages ├── adding-a-language.md ├── contributing.md ├── encoding.md ├── index.md ├── locales.md ├── overrides.md └── translating.md ├── mail-providers ├── getting-started.md ├── index.md ├── provider-settings.md └── send-notification.md ├── modules ├── code-samples.md ├── getting-started.md ├── index.md ├── marketplace.md ├── module-class-autoloading.md └── style-guide.md ├── notification-providers ├── dynamic-fields.md ├── getting-started.md ├── index.md ├── initialisation.md ├── notification-settings.md ├── provider-settings.md └── send-notification.md ├── oauth ├── api.md ├── auth-workflow.md ├── further-reading.md ├── index.md └── introduction.md ├── payment-gateways ├── 3d-secure.md ├── callbacks.md ├── configuration.md ├── displaying-balances.md ├── getting-started.md ├── index.md ├── installation-activation.md ├── merchant-gateway.md ├── meta-data-params.md ├── refunds.md ├── remote-input-gateway.md ├── reversals.md ├── subscription-management.md ├── third-party-gateway.md ├── tokenised-remote-storage.md └── transaction-information.md ├── provisioning-modules ├── admin-dashboard-widgets.md ├── admin-services-tab.md ├── client-area-output.md ├── config-options.md ├── core-module-functions.md ├── cpanel-advanced-mode.png ├── cpanel-simple-mode.png ├── custom-actions.md ├── custom-functions.md ├── getting-started.md ├── index.md ├── loader-functions.md ├── meta-data-params.md ├── module-logging.md ├── module-parameters.md ├── server-sync.md ├── service-properties.md ├── simple-mode.md ├── single-sign-on.md ├── supported-functions.md ├── usage-metrics.md └── usage-update.md └── themes ├── child-themes.md ├── conditionals.md ├── css-styling.md ├── customising.md ├── debugging.md ├── functions.md ├── getting-started.md ├── github.md ├── index.md ├── navigation.md ├── navigation └── menus-find-name.png ├── order-form-templates.md ├── php.md ├── sidebars.md ├── sidebars └── find-sidebar-name.png ├── smarty.md ├── testing.md ├── theme-parameters.md └── variables.md /README.md: -------------------------------------------------------------------------------- 1 | # WHMCS Developer Documentation 2 | 3 | This is the repository for the WHMCS Developer Documentation located at http://developers.whmcs.com/ 4 | 5 | We welcome you to create issues and submit pull requests for any suggestions, corrections and improvements you would like to see. 6 | 7 | [WHMCS](http://www.whmcs.com/) | [Contact Support](https://www.whmcs.com/support/) | [WHMCS.Community](https://whmcs.community/) 8 | -------------------------------------------------------------------------------- /about/contribute.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Contribute" 3 | weight = 10 4 | 5 | +++ 6 | 7 | This documentation site is hosted on GitHub. 8 | 9 | We welcome users and developers to submit issues and pull requests with suggestions for change, improvements and corrections. 10 | 11 | https://github.com/WHMCS/developer-docs 12 | -------------------------------------------------------------------------------- /about/faq.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Frequently Asked Questions" 3 | weight = 20 4 | 5 | +++ 6 | 7 | ### Q. Who is the intended audience of this website? 8 | 9 | Our developer documentation portal is designed for developers wishing to work with, customise, extend and develop for the WHMCS platform. 10 | 11 | ### Q. Who can I contact if I need support? 12 | 13 | We have a developers community available @ https://whmcs.community/forum/41-developer-corner/ 14 | 15 | Basic development support is offered by our Technical Support Team. 16 | 17 | For more advanced support needs, we recommend contacting partners[at]whmcs.com 18 | 19 | ### Q. Where can I find end user documentation? 20 | 21 | If you are looking for end user documentation relating to the WHMCS product, please [click here](http://docs.whmcs.com/) 22 | -------------------------------------------------------------------------------- /about/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | next = "" 5 | title = "About" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ## About WHMCS 11 | 12 | WHMCS is a web host billing & automation platform. 13 | 14 | Launched in 2005, today WHMCS is the market leading platform of choice for Web Hosting Providers and Domain Registrars to automate and manage their businesses. 15 | 16 | Handling the entire customer lifecycle from initial signup, to provisioning, management and support, WHMCS provides a single centralized platform for web hosting businesses to manage their operations, making every day tasks quicker, easier, and more efficient. 17 | 18 | With over 10 years experience and development, a large and active developer community, and our commitment to responding to user requests and leading the way with the latest web hosting technologies and developments, WHMCS is a rich and powerful platform that sets the standard in web host billing automation. 19 | 20 | **WHMCS**
21 | 2550 North Loop West
22 | Suite 500
23 | Houston, TX 77092
24 | United States 25 | 26 | Email us [sales@whmcs.com](mailto:sales@whmcs.com) 27 | -------------------------------------------------------------------------------- /about/quick-start.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "Quick Start" 3 | weight = 5 4 | 5 | +++ 6 | 7 | ## What would you like to do? 8 | 9 | * [Create a custom WHMCS client area theme](/themes/getting-started)
A theme in WHMCS controls the client facing user interface. Create a seamless experience for your visitors by creating a custom client area theme that matches the rest of your website. 10 | * [Create a Provisioning Module](/provisioning-modules)
Provisioning Modules enable provisioning and management of services in WHMCS. They are also sometimes referred to as Product or Server Modules. 11 | * [Create an Addon Module](/addon-modules)
Addon Modules allow you to create both admin pages and hooks to extend WHMCS further. 12 | * [Create a Domain Registar Module](/domain-registrars)
Registrar Modules allow for the registration and management of domains within WHMCS. Registrar Modules are also referred to as Domain Modules. 13 | * [Create a Payment Gateway Module](/payment-gateways)
Creating a Payment Gateway Module allows you to connect and integrate WHMCS with additional payment service providers. 14 | * [Create a Mail Provider Module](/mail-providers)
Mail Provider Modules allow you to add custom mail providers to WHMCS. 15 | * [Integrate WHMCS with 3rd party systems using the API](/api)
The WHMCS API allows you to perform operations and actions within WHMCS from external third party and custom code. 16 | * [Browse the API Reference](/api-reference)
A complete listing of API functions available in WHMCS. 17 | * [Integrate 3rd party systems into WHMCS using Hooks](/hooks)
Hooks allow you to execute your own code when events occur inside WHMCS. 18 | * [Browse the Hook Reference](/hooks-reference)
A complete listing of Hook Points available in WHMCS. 19 | * [Interact and retrieve data from the WHMCS Database](/advanced/db-interaction)
Learn how to interact with the WHMCS database. 20 | * [Create a new language](/languages/adding-a-language)
Create your own additional language translations. 21 | * [Upgrade to WHMCS 8.0](/advanced/upgrade-to-whmcs-8)
View important information about updating your code for WHMCS 8.0. 22 | -------------------------------------------------------------------------------- /addon-modules/admin-area-output.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/addon-modules/client-area-output" 3 | prev = "/addon-modules/installation-uninstallation" 4 | title = "Admin Area Content/Output" 5 | toc = true 6 | weight = 40 7 | 8 | +++ 9 | 10 | The output from modules is defined in the function `your_module_name_output`. 11 | This should be actually output (i.e. echo’d) and not returned. 12 | All output is captured by WHMCS and displayed within the admin interface template. 13 | 14 | ## Variables 15 | 16 | The output function is passed all the fields defined in your modules configuration function, along with the values users have set for them, as well as a `modulelink` parameter which provides the URI to link back to the module. 17 | 18 | ## Linking/Actions 19 | 20 | Using the `modulelink` parameter you can build urls that post back to your module. 21 | The modulelink will be in the format "_addonmodules.php?module=xxxxxx_". For links you can then append “_&var1=x&var2=y_”. 22 | For forms, use the POST form method to receive user input. 23 | 24 | Within the output function, the `$_GET` or `$_POST` variables can be accessed directly to retrieve user input. 25 | 26 | ## Admin User Data 27 | 28 | To access the currently logged in admin user ID, use `$_SESSION['adminid']`. 29 | You can use the ID to retrieve any additional information that is required from the tbladmins table in the database. 30 | 31 | ## Example Output Function 32 | 33 | ``` 34 | function demo_output($vars) { 35 | 36 | $modulelink = $vars['modulelink']; 37 | $version = $vars['version']; 38 | $option1 = $vars['option1']; 39 | $option2 = $vars['option2']; 40 | $option3 = $vars['option3']; 41 | $option4 = $vars['option4']; 42 | $option5 = $vars['option5']; 43 | $option6 = $vars['option6']; 44 | $LANG = $vars['_lang']; 45 | 46 | echo '

The date & time are currently ' . date("Y-m-d H:i:s") . '

'; 47 | 48 | } 49 | ``` 50 | 51 | Things aren't limited to just one file. 52 | Use the **_output** function to include other files, call templates, etc. 53 | The system is flexible. 54 | -------------------------------------------------------------------------------- /addon-modules/admin-dashboard-widgets.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/addon-modules/upgrades" 3 | prev = "/addon-modules/hooks" 4 | title = "Admin Dashboard Widgets" 5 | toc = true 6 | weight = 80 7 | 8 | +++ 9 | 10 | Admin Dashboard Widgets are displayed on the admin area homepage. 11 | 12 | They allow you to provide convenient access to key information and functionality from your module within the admin homepage dashboard. 13 | 14 | Below is an example of how a dashboard widget is defined. 15 | 16 | ``` 17 | 45 | Hello World! 46 | 47 | EOF; 48 | } 49 | } 50 | ``` 51 | 52 | More information on the AbstractWidget class used in the above example can be found at http://docs.whmcs.com/classes/7.1/WHMCS/Module/AbstractWidget.html 53 | -------------------------------------------------------------------------------- /addon-modules/client-area-output.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/addon-modules/multi-language" 3 | prev = "/addon-modules/admin-area-output" 4 | title = "Client Area Output" 5 | toc = true 6 | weight = 50 7 | 8 | +++ 9 | 10 | Addon Modules also support generating client area output. 11 | This is done with the use of an **_clientarea** function within the module. 12 | 13 | The functionality allows for modules to return output in the form of template files. 14 | The template files are stored within the module folder. 15 | 16 | You can return a page title, breadcrumb path, and template variables. 17 | You can also require a client login with a simple true/false response. 18 | Language strings from the modules language file ([see here][language]) are also available. 19 | 20 | Access Client area modules using an URL in the format **index.php?m=modulename** 21 | 22 | ## Example Client Area Function 23 | 24 | Here is a sample client area function demonstrating all the available return variables: 25 | 26 | ``` 27 | function demo_clientarea($vars) { 28 | 29 | $modulelink = $vars['modulelink']; 30 | $version = $vars['version']; 31 | $option1 = $vars['option1']; 32 | $option2 = $vars['option2']; 33 | $option3 = $vars['option3']; 34 | $option4 = $vars['option4']; 35 | $option5 = $vars['option5']; 36 | $option6 = $vars['option6']; 37 | $LANG = $vars['_lang']; 38 | 39 | return array( 40 | 'pagetitle' => 'Addon Module', 41 | 'breadcrumb' => array('index.php?m=demo'=>'Demo Addon'), 42 | 'templatefile' => 'clienthome', 43 | 'requirelogin' => true, # accepts true/false 44 | 'forcessl' => false, # accepts true/false 45 | 'vars' => array( 46 | 'testvar' => 'demo', 47 | 'anothervar' => 'value', 48 | 'sample' => 'test', 49 | ), 50 | ); 51 | 52 | } 53 | ``` 54 | 55 | The above assumes a template, **clienthome.tpl**, existing within the module folder to use for the output. 56 | 57 | 58 | [language]: /addon-modules/multi-language "Multi Language Support" 59 | -------------------------------------------------------------------------------- /addon-modules/getting-started.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/addon-modules/configuration" 3 | prev = "/addon-modules" 4 | title = "Getting Started" 5 | toc = true 6 | weight = 10 7 | 8 | +++ 9 | 10 | To get started, you need to begin by choosing a name for your module. 11 | The module name chosen must be unique and should be all lowercase. 12 | The name must only contain letters & numbers whilst always starting with a letter. 13 | Underscore is the only accepted special character. 14 | For example, valid names would be: 15 | 16 | 17 | **mymodulename** OR **my_module_name** OR **my_module** 18 | 19 | 20 | Once you have chosen your name, you need to create a directory and module file for it. 21 | Addon modules are found in the `/modules/addons/` directory. 22 | Each module can be found within it's own directory **/your_module_name/**. 23 | Then the core module file within it should be "**your_module_name**.php" to match the folder. 24 | 25 | We make available a sample addon module on GitHub. We recommend using this as a starting point for a custom addon module. 26 | 27 | > https://github.com/WHMCS/sample-addon-module 28 | -------------------------------------------------------------------------------- /addon-modules/hooks.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/addon-modules/admin-dashboard-widgets" 3 | prev = "/addon-modules/multi-language" 4 | title = "Hooks" 5 | toc = true 6 | weight = 70 7 | 8 | +++ 9 | 10 | Hooks that the module should define within WHMCS are defined in a file named “hooks.php”. 11 | This should be within your custom module folder. 12 | That will then become detected and any hooks that exist will be loaded on every page of WHMCS. 13 | 14 | The hook functions within that file should be defined in exactly the same way as normal. 15 | 16 | Please refer to [Hook Documentation][hook-documentation] for more info on creating and working with hooks in WHMCS. 17 | 18 | [hook-documentation]: https://developers.whmcs.com/hooks/ "Hooks" 19 | -------------------------------------------------------------------------------- /addon-modules/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | title = "Addon Modules" 5 | next = "/addon-modules/getting-started" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ## Introduction 11 | 12 | Addon Modules allow you to create both admin pages and hooks to extend WHMCS further. 13 | 14 | Addon Modules can consist of just an admin page, just hooks, or both. 15 | They are all managed through the **Setup** > **Addon Modules** interface. 16 | 17 | There are other types of module in WHMCS. These are [Payment Gateways][gateway-modules], [Provisioning Modules][provisioning-modules], [Mail Provider Modules][mail-providers] and [Registrar Modules][registrar-modules]. 18 | 19 | Once activated, modules will display in the **Addons** menu within the admin area for access from any page. 20 | 21 | Management options consist of activating and deactivating of the modules. 22 | Access control allows full admins to define which of the administrator roles can access each addon module. 23 | 24 | We have a **Video Tutorial** demonstrating addon module management and access control [here][video-tutorial]. 25 | 26 | 27 | 28 | [gateway-modules]: ../payment-gateways "Gateway Module Documentation" 29 | [provisioning-modules]: ../provisioning-modules "Provisioning Module Developer Documentation" 30 | [mail-providers]: ../mail-providers "Mail Provider Module Developer Documentation" 31 | [registrar-modules]: ../domain-registrars "Registrar Module Developer Documentation" 32 | [video-tutorial]: https://www.youtube.com/watch?v=39TpVTs8onE "Addon Modules" 33 | -------------------------------------------------------------------------------- /addon-modules/multi-language.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/addon-modules/hooks" 3 | prev = "/addon-modules/client-area-output" 4 | title = "Multi-Language Support" 5 | toc = true 6 | weight = 60 7 | 8 | +++ 9 | 10 | Modules can support multiple languages should you wish. 11 | 12 | For this, the addon module needs a lang subfolder created within it. 13 | Within that, language files can be created matching the names of the main WHMCS admin area language files. 14 | The admin language files are located in the /admin/lang/ folder. 15 | 16 | WHMCS has the language variables for custom modules separate to make installation and updating easier. 17 | 18 | If language files exist, WHMCS will then load these whenever the custom module is accessed. 19 | WHMCS will select the appropriate language file based on the current administrators language setting. 20 | If no matching language file exists within the module folder, it will fall back to the default language set in the module’s config array. 21 | 22 | A language file would be located at `/modules/addons/youraddonname/lang/english.php` 23 | 24 | ## Example Language File 25 | 26 | ``` 27 | $_ADDONLANG['intro'] = "This is an example module to be used as a starting point for developers."; 28 | $_ADDONLANG['description'] = "Creating an addon module is easy and this example demonstrates all the functionality an addon module can utilise.

Addon modules offer the ultimate flexibility allowing you to create anything from a simple extra admin area page, to advanced fully custom modules interfacing with remote third party systems and hooking into & extending the core system."; 29 | $_ADDONLANG['documentation'] = "This file is not protected so you can have a look at it"; 30 | ``` 31 | 32 | The language variables are then passed into the _output and _sidebar functions array using “_lang”. 33 | 34 | Below is a demonstration of how you specify the default language for your module in the config array. 35 | 36 | ## Specifying Default Addon Module Language 37 | 38 | ``` 39 | function demo_config() { 40 | $configarray = array( 41 | "name" => "Addon Example", 42 | "description" => "This is a sample config function for an addon module", 43 | "version" => "1.0", 44 | "author" => "WHMCS", 45 | "language" => "english", 46 | "fields" => etc... 47 | ``` 48 | -------------------------------------------------------------------------------- /addon-modules/upgrades.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/addon-modules/whmcs-marketplace" 3 | prev = "/addon-modules/admin-dashboard-widgets" 4 | title = "Upgrades" 5 | toc = true 6 | weight = 90 7 | 8 | +++ 9 | 10 | Releasing updates and upgrades to custom modules is likely something that is needed to be done at some point. 11 | If those modules need to modify the database structure or perform other functions that would be handled in the **_activate** function, then you need some way of handling that. 12 | 13 | With the Addon Modules system, this is a breeze with the upgrade function. 14 | The upgrade function is called the first time a module is accessed following an update. 15 | The update is detected by a change of version number in the **_config** array of the module. 16 | The upgrade function is passed the previous version number so that the module can then decide what updates to run within that function. 17 | This allows the module to bring it up to date with your latest version. 18 | 19 | ## Example Upgrade Function 20 | 21 | An example of how this function can be used is demonstrated below: 22 | 23 | ``` 24 | function addonmodule_upgrade($vars) 25 | { 26 | $currentlyInstalledVersion = $vars['version']; 27 | 28 | // Perform SQL schema changes required by the upgrade to version 1.1 of your module 29 | if ($currentlyInstalledVersion < 1.1) { 30 | $schema = Capsule::schema(); 31 | // Alter the table and add a new text column called "demo2" 32 | $schema->table('mod_addonexample', function($table) { 33 | $table->text('demo2'); 34 | }); 35 | } 36 | 37 | //Perform SQL schema changes required by the upgrade to version 1.2 of your module 38 | if ($currentlyInstalledVersion < 1.2) { 39 | $schema = Capsule::schema(); 40 | // Alter the table and add a new text column called "demo3" 41 | $schema->table('mod_addonexample', function($table) { 42 | $table->text('demo3'); 43 | }); 44 | } 45 | } 46 | ``` 47 | -------------------------------------------------------------------------------- /addon-modules/whmcs-marketplace.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/addon-modules/upgrades" 3 | title = "WHMCS Marketplace" 4 | toc = true 5 | weight = 100 6 | 7 | +++ 8 | 9 | WHMCS offers a Marketplace which accepts submission of the completed module. 10 | Displayed listed are found under the Addons tab within the administration area and [online][marketplace]. 11 | This is a great way to make WHMCS users aware of the module. 12 | 13 | For help using the Marketplace please click [here][marketplace-help]. 14 | We aim to review submissions in 1-2 weeks. 15 | 16 | [marketplace]: https://marketplace.whmcs.com "WHMCS Marketplace" 17 | [marketplace-help]: https://marketplace.whmcs.com/help "WHMCS Marketplace Help" 18 | -------------------------------------------------------------------------------- /advanced/currency-formatting.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/advanced/logging/" 3 | prev = "/advanced/date-functions/" 4 | title = "Currency Formatting" 5 | weight = 40 6 | 7 | +++ 8 | 9 | The following helper functions are provided for formatting currency values. 10 | 11 | ## Get Clients Currency 12 | 13 | ``` 14 | /** 15 | * Get clients currency 16 | * 17 | * Required before making a call to formatCurrency 18 | * 19 | * @param int $clientId The database ID number of the client to retrieve the currency information from 20 | * 21 | * @return array 22 | */ 23 | $currencyData = getCurrency($clientId); 24 | ``` 25 | 26 | ## Format Currency 27 | 28 | ``` 29 | /** 30 | * Format currency 31 | * 32 | * @param float $amount 33 | * @param int $currencyId 34 | * 35 | * @return \WHMCS\View\Formatter\Price 36 | */ 37 | $price = formatCurrency($amount, $currencyData['id']); 38 | ``` 39 | 40 | The `$price` value returned will be an object. The default `__toString` response format is a fully formatted price output including prefix and suffix. 41 | 42 | See https://classdocs.whmcs.com/8.1/WHMCS/View/Formatter/Price.html for more information. 43 | -------------------------------------------------------------------------------- /advanced/date-functions.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/advanced/currency-formatting/" 3 | prev = "/advanced/db-interaction/" 4 | title = "Date Functions" 5 | weight = 30 6 | 7 | +++ 8 | 9 | The following date helper functions are made available to make it easier to work with dates in WHMCS. 10 | 11 | ## Todays Date 12 | 13 | ``` 14 | /** 15 | * Returns todays date 16 | * 17 | * By default returns the format defined in General Settings > Localisation > Date Format 18 | * 19 | * @param bool $applyClientDateFormat Set true to apply Localisation > Client Date Format 20 | * 21 | * @return string 22 | */ 23 | $todaysdate = getTodaysDate($applyClientDateFormat); 24 | ``` 25 | 26 | ## From MySQL Date 27 | 28 | ``` 29 | /** 30 | * Formats a MySQL Date/Timestamp value to system settings 31 | * 32 | * @param string $datetimestamp The MySQL Date/Timestamp value 33 | * @param bool $includeTime Pass true to include the time in the result 34 | * @param bool $applyClientDateFormat Set true to apply Localisation > Client Date Format 35 | * 36 | * @return string 37 | */ 38 | $date = fromMySQLDate($date, $includeTime, $applyClientDateFormat); 39 | ``` 40 | 41 | ## To MySQL Date 42 | 43 | ``` 44 | /** 45 | * Converts a date entered in the system setting format to a MySQL Date/Timestamp 46 | * 47 | * @param string $userInputDate 48 | * 49 | * @return string Format: 2016-12-30 23:59:59 50 | */ 51 | $date = toMySQLDate($date); 52 | ``` 53 | -------------------------------------------------------------------------------- /advanced/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | next = "/advanced/creating-pages/" 5 | title = "Advanced" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ## Introduction 11 | 12 | The following are some advanced customisation options. 13 | 14 | * **[Upgrading to WHMCS 8.0](/advanced/upgrade-to-whmcs-8/)**
Everything you need to know to ensure a smooth transition to Version 8. 15 | * **[Creating Pages](/advanced/creating-pages/)**
Learn how to create additional pages within the WHMCS client area. 16 | * **[Authentication via CurrentUser](/advanced/authentication/)**
Learn how to assess the current authentication state with `CurrentUser`. 17 | * **[Interacting with the Database](/advanced/db-interaction/)**
Learn how to interact with the WHMCS database 18 | * **[Date Functions](/advanced/date-functions/)**
Learn how to use the date helper functions in WHMCS 19 | * **[Currency Formatting](/advanced/currency-formatting/)**
Learn how to use the currency formatting helper functions in WHMCS 20 | * **[Logging](/advanced/logging/)**
Learn how to use the logging helper functions in WHMCS 21 | * **[Widgets](/advanced/widgets/)**
Learn how to create widgets using AbstractWidget 22 | * **[JSON File](/advanced/json-file/)**
Provide meta information for modules 23 | -------------------------------------------------------------------------------- /advanced/logging.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/advanced/widgets/" 3 | prev = "/advanced/currency-formatting/" 4 | title = "Logging" 5 | weight = 50 6 | 7 | +++ 8 | 9 | The following logging helper methods are made available in WHMCS. 10 | 11 | ## Log Activity 12 | 13 | A helper method is available for adding entries to the activity log. 14 | 15 | This function is available to all hooks, modules and template files throughout the WHMCS system. 16 | 17 | ``` 18 | /** 19 | * Log activity. 20 | * 21 | * @param string $message The message to log 22 | * @param int $clientId An optional client id to which the log entry relates 23 | */ 24 | logActivity('Message goes here', 0); 25 | ``` 26 | 27 | ## Log Module Call 28 | 29 | We recommend making use of the module log to record all external API calls and requests. 30 | 31 | This makes debugging the external API calls your modules make easier and consistent with other modules. 32 | 33 | ``` 34 | /** 35 | * Log module call. 36 | * 37 | * @param string $module The name of the module 38 | * @param string $action The name of the action being performed 39 | * @param string|array $requestString The input parameters for the API call 40 | * @param string|array $responseData The response data from the API call 41 | * @param string|array $processedData The resulting data after any post processing (eg. json decode, xml decode, etc...) 42 | * @param array $replaceVars An array of strings for replacement 43 | */ 44 | logModuleCall($module, $action, $requestString, $responseData, $processedData, $replaceVars); 45 | ``` 46 | 47 | We recommend passing data strings such as usernames and passwords into the `$replaceVars` parameter to allow them to be automatically scrubbed and omitted from module log entries. 48 | -------------------------------------------------------------------------------- /advanced/module-image-placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHMCS/developer-docs/4ac5dfe89b1a085b04808f1199a5f04cf11bd9f9/advanced/module-image-placeholder.png -------------------------------------------------------------------------------- /advanced/sample-widget-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHMCS/developer-docs/4ac5dfe89b1a085b04808f1199a5f04cf11bd9f9/advanced/sample-widget-output.png -------------------------------------------------------------------------------- /api-reference/acceptquote.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "AcceptQuote" 3 | toc = true 4 | +++ 5 | 6 | Accepts a quote 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "AcceptQuote" | Required | 13 | | quoteid | int | The quote id to be accepted and converted to an invoice | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | | invoiceid | int | The newly created invoice id | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'AcceptQuote', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'quoteid' => '1', 37 | 'responsetype' => 'json', 38 | ) 39 | ) 40 | ); 41 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 42 | $response = curl_exec($ch); 43 | curl_close($ch); 44 | ``` 45 | 46 | 47 | ### Example Request (Local API) 48 | 49 | ``` 50 | $command = 'AcceptQuote'; 51 | $postData = array( 52 | 'quoteid' => '1', 53 | ); 54 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 55 | 56 | $results = localAPI($command, $postData, $adminUsername); 57 | print_r($results); 58 | ``` 59 | 60 | 61 | ### Example Response JSON 62 | 63 | ``` 64 | { 65 | "result": "success" 66 | } 67 | ``` 68 | 69 | 70 | ### Error Responses 71 | 72 | Possible error condition responses include: 73 | 74 | * Quote ID Not Found 75 | 76 | 77 | ### Version History 78 | 79 | | Version | Changelog | 80 | | ------- | --------- | 81 | | 1.0 | Initial Version | 82 | -------------------------------------------------------------------------------- /api-reference/addbannedip.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "AddBannedIp" 3 | toc = true 4 | +++ 5 | 6 | Adds an IP to the ban list. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "AddBannedIp" | Required | 13 | | ip | string | | Required | 14 | | reason | string | Admin only reason | Required | 15 | | days | int | If passed, expires date is auto calculated | Required | 16 | | expires | \datetime | YYYY-MM-DD HH:MM:SS | Optional | 17 | 18 | ### Response Parameters 19 | 20 | | Parameter | Type | Description | 21 | | --------- | ---- | ----------- | 22 | | result | string | The result of the operation: success or error | 23 | | banid | int | The id of the new ban entry | 24 | 25 | 26 | ### Example Request (CURL) 27 | 28 | ``` 29 | $ch = curl_init(); 30 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 31 | curl_setopt($ch, CURLOPT_POST, 1); 32 | curl_setopt($ch, CURLOPT_POSTFIELDS, 33 | http_build_query( 34 | array( 35 | 'action' => 'AddBannedIp', 36 | // See https://developers.whmcs.com/api/authentication 37 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 38 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 39 | 'ip' => '1.2.3.4', 40 | 'reason' => 'Abuse', 41 | 'days' => '30', 42 | 'responsetype' => 'json', 43 | ) 44 | ) 45 | ); 46 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 47 | $response = curl_exec($ch); 48 | curl_close($ch); 49 | ``` 50 | 51 | 52 | ### Example Request (Local API) 53 | 54 | ``` 55 | $command = 'AddBannedIp'; 56 | $postData = array( 57 | 'ip' => '1.2.3.4', 58 | 'reason' => 'Abuse', 59 | 'days' => '30', 60 | ); 61 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 62 | 63 | $results = localAPI($command, $postData, $adminUsername); 64 | print_r($results); 65 | ``` 66 | 67 | 68 | ### Example Response JSON 69 | 70 | ``` 71 | { 72 | "result": "success", 73 | "banid": "1" 74 | } 75 | ``` 76 | 77 | 78 | ### Version History 79 | 80 | | Version | Changelog | 81 | | ------- | --------- | 82 | | 1.0 | Initial Version | 83 | -------------------------------------------------------------------------------- /api-reference/affiliateactivate.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "AffiliateActivate" 3 | toc = true 4 | +++ 5 | 6 | Activate affiliate referrals for a client. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "AffiliateActivate" | Required | 13 | | userid | int | The client ID to activate affiliate status for | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'AffiliateActivate', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'userid' => '1', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'AffiliateActivate'; 50 | $postData = array( 51 | 'userid' => '1', 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success" 65 | } 66 | ``` 67 | 68 | 69 | ### Error Responses 70 | 71 | Possible error condition responses include: 72 | 73 | * Client ID not found 74 | 75 | 76 | ### Version History 77 | 78 | | Version | Changelog | 79 | | ------- | --------- | 80 | | 1.0 | Initial Version | 81 | -------------------------------------------------------------------------------- /api-reference/blockticketsender.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "BlockTicketSender" 3 | toc = true 4 | +++ 5 | 6 | Blocks a ticket sender. 7 | 8 | Blocks an unregistered ticket sender, optionally deleting the ticket. Deleting the ticket cannot be undone. 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "BlockTicketSender" | Required | 15 | | ticketid | int | The ticket the sender opened | Required | 16 | | delete | bool | Should the ticket also be deleted | Optional | 17 | 18 | ### Response Parameters 19 | 20 | | Parameter | Type | Description | 21 | | --------- | ---- | ----------- | 22 | | result | string | The result of the operation: success or error | 23 | 24 | 25 | ### Example Request (CURL) 26 | 27 | ``` 28 | $ch = curl_init(); 29 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 30 | curl_setopt($ch, CURLOPT_POST, 1); 31 | curl_setopt($ch, CURLOPT_POSTFIELDS, 32 | http_build_query( 33 | array( 34 | 'action' => 'BlockTicketSender', 35 | // See https://developers.whmcs.com/api/authentication 36 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 37 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 38 | 'ticketid' => '1', 39 | 'responsetype' => 'json', 40 | ) 41 | ) 42 | ); 43 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 44 | $response = curl_exec($ch); 45 | curl_close($ch); 46 | ``` 47 | 48 | 49 | ### Example Request (Local API) 50 | 51 | ``` 52 | $command = 'BlockTicketSender'; 53 | $postData = array( 54 | 'ticketid' => '1', 55 | ); 56 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 57 | 58 | $results = localAPI($command, $postData, $adminUsername); 59 | print_r($results); 60 | ``` 61 | 62 | 63 | ### Example Response JSON 64 | 65 | ``` 66 | { 67 | "result": "success", 68 | "deleted": "true" 69 | } 70 | ``` 71 | 72 | 73 | ### Error Responses 74 | 75 | Possible error condition responses include: 76 | 77 | * Ticket ID Required 78 | * Ticket ID Not Found 79 | 80 | 81 | ### Version History 82 | 83 | | Version | Changelog | 84 | | ------- | --------- | 85 | | 7.10.0 | Initial Version | 86 | -------------------------------------------------------------------------------- /api-reference/cancelorder.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "CancelOrder" 3 | toc = true 4 | +++ 5 | 6 | Cancel a Pending Order 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "CancelOrder" | Required | 13 | | orderid | int | The ID of the pending order | Required | 14 | | cancelsub | bool | Attempt to cancel the subscription associated with the products | Optional | 15 | | noemail | bool | Set to true to stop the invoice payment email being sent if the invoice becomes paid | Optional | 16 | 17 | ### Response Parameters 18 | 19 | | Parameter | Type | Description | 20 | | --------- | ---- | ----------- | 21 | | result | string | The result of the operation: success or error | 22 | 23 | 24 | ### Example Request (CURL) 25 | 26 | ``` 27 | $ch = curl_init(); 28 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 29 | curl_setopt($ch, CURLOPT_POST, 1); 30 | curl_setopt($ch, CURLOPT_POSTFIELDS, 31 | http_build_query( 32 | array( 33 | 'action' => 'CancelOrder', 34 | // See https://developers.whmcs.com/api/authentication 35 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 36 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 37 | 'orderid' => '1', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'CancelOrder'; 52 | $postData = array( 53 | 'orderid' => '1', 54 | ); 55 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 56 | 57 | $results = localAPI($command, $postData, $adminUsername); 58 | print_r($results); 59 | ``` 60 | 61 | 62 | ### Example Response JSON 63 | 64 | ``` 65 | { 66 | "result": "success" 67 | } 68 | ``` 69 | 70 | 71 | ### Error Responses 72 | 73 | Possible error condition responses include: 74 | 75 | * Order ID not found or Status not Pending 76 | * Subscription Cancellation Failed - Please check the gateway log for further information 77 | 78 | 79 | ### Version History 80 | 81 | | Version | Changelog | 82 | | ------- | --------- | 83 | | 1.0 | Initial Version | 84 | -------------------------------------------------------------------------------- /api-reference/capturepayment.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "CapturePayment" 3 | toc = true 4 | +++ 5 | 6 | Attempt to capture a payment on an unpaid CC Invoice 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "CapturePayment" | Required | 13 | | invoiceid | int | The ID of the pending order | Required | 14 | | cvv | string | The CVV Number for the card being attempted | Optional | 15 | 16 | ### Response Parameters 17 | 18 | | Parameter | Type | Description | 19 | | --------- | ---- | ----------- | 20 | | result | string | The result of the operation: success or error | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'CapturePayment', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'invoiceid' => '1', 37 | 'responsetype' => 'json', 38 | ) 39 | ) 40 | ); 41 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 42 | $response = curl_exec($ch); 43 | curl_close($ch); 44 | ``` 45 | 46 | 47 | ### Example Request (Local API) 48 | 49 | ``` 50 | $command = 'CapturePayment'; 51 | $postData = array( 52 | 'invoiceid' => '1', 53 | ); 54 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 55 | 56 | $results = localAPI($command, $postData, $adminUsername); 57 | print_r($results); 58 | ``` 59 | 60 | 61 | ### Example Response JSON 62 | 63 | ``` 64 | { 65 | "result": "success" 66 | } 67 | ``` 68 | 69 | 70 | ### Error Responses 71 | 72 | Possible error condition responses include: 73 | 74 | * Invoice Not Found or Not Unpaid 75 | * Payment Attempt Failed 76 | 77 | 78 | ### Version History 79 | 80 | | Version | Changelog | 81 | | ------- | --------- | 82 | | 1.0 | Initial Version | 83 | -------------------------------------------------------------------------------- /api-reference/closeclient.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "CloseClient" 3 | toc = true 4 | +++ 5 | 6 | Close a Client. 7 | 8 | This will close the client, cancel any invoices and set the status of all products to Cancelled or Terminated. 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "CloseClient" | Required | 15 | | clientid | int | The ID of the client to close | Required | 16 | 17 | ### Response Parameters 18 | 19 | | Parameter | Type | Description | 20 | | --------- | ---- | ----------- | 21 | | result | string | The result of the operation: success or error | 22 | | clientid | int | The ID of the client that was closed. | 23 | 24 | 25 | ### Example Request (CURL) 26 | 27 | ``` 28 | $ch = curl_init(); 29 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 30 | curl_setopt($ch, CURLOPT_POST, 1); 31 | curl_setopt($ch, CURLOPT_POSTFIELDS, 32 | http_build_query( 33 | array( 34 | 'action' => 'CloseClient', 35 | // See https://developers.whmcs.com/api/authentication 36 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 37 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 38 | 'clientid' => '1', 39 | 'responsetype' => 'json', 40 | ) 41 | ) 42 | ); 43 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 44 | $response = curl_exec($ch); 45 | curl_close($ch); 46 | ``` 47 | 48 | 49 | ### Example Request (Local API) 50 | 51 | ``` 52 | $command = 'CloseClient'; 53 | $postData = array( 54 | 'clientid' => '1', 55 | ); 56 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 57 | 58 | $results = localAPI($command, $postData, $adminUsername); 59 | print_r($results); 60 | ``` 61 | 62 | 63 | ### Example Response JSON 64 | 65 | ``` 66 | { 67 | "result": "success" 68 | } 69 | ``` 70 | 71 | 72 | ### Error Responses 73 | 74 | Possible error condition responses include: 75 | 76 | * Client ID Not Found 77 | * An unexpected error occurred: xxx 78 | 79 | 80 | ### Version History 81 | 82 | | Version | Changelog | 83 | | ------- | --------- | 84 | | 1.0 | Initial Version | 85 | -------------------------------------------------------------------------------- /api-reference/decryptpassword.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DecryptPassword" 3 | toc = true 4 | +++ 5 | 6 | Decrypt an encrypted string 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "DecryptPassword" | Required | 13 | | password2 | string | The string to decrypt | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'DecryptPassword', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'password2' => 'vNRQzRPKQA6obJpHMHCBivS0D9/Pf532oArYvewP', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'DecryptPassword'; 50 | $postData = array( 51 | 'password2' => 'vNRQzRPKQA6obJpHMHCBivS0D9/Pf532oArYvewP', 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success", 65 | "password": "teststring" 66 | } 67 | ``` 68 | 69 | 70 | ### Version History 71 | 72 | | Version | Changelog | 73 | | ------- | --------- | 74 | | 1.0 | Initial Version | 75 | -------------------------------------------------------------------------------- /api-reference/deleteannouncement.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DeleteAnnouncement" 3 | toc = true 4 | +++ 5 | 6 | Delete an announcement 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "DeleteAnnouncement" | Required | 13 | | announcementid | int | The id of the announcement to be deleted | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'DeleteAnnouncement', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'announcementid' => '1', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'DeleteAnnouncement'; 50 | $postData = array( 51 | 'announcementid' => '1', 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success", 65 | "announcementid": "1" 66 | } 67 | ``` 68 | 69 | 70 | ### Version History 71 | 72 | | Version | Changelog | 73 | | ------- | --------- | 74 | | 1.0 | Initial Version | 75 | -------------------------------------------------------------------------------- /api-reference/deletecontact.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DeleteContact" 3 | toc = true 4 | +++ 5 | 6 | Deletes a contact. 7 | 8 | Removes contact record. This action cannot be undone. 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DeleteContact" | Required | 15 | | contactid | int | The contact id to be deleted | Required | 16 | 17 | ### Response Parameters 18 | 19 | | Parameter | Type | Description | 20 | | --------- | ---- | ----------- | 21 | | result | string | The result of the operation: success or error | 22 | | contactid | int | The contact id that was deleted | 23 | 24 | 25 | ### Example Request (CURL) 26 | 27 | ``` 28 | $ch = curl_init(); 29 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 30 | curl_setopt($ch, CURLOPT_POST, 1); 31 | curl_setopt($ch, CURLOPT_POSTFIELDS, 32 | http_build_query( 33 | array( 34 | 'action' => 'DeleteContact', 35 | // See https://developers.whmcs.com/api/authentication 36 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 37 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 38 | 'contactid' => '1', 39 | 'responsetype' => 'json', 40 | ) 41 | ) 42 | ); 43 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 44 | $response = curl_exec($ch); 45 | curl_close($ch); 46 | ``` 47 | 48 | 49 | ### Example Request (Local API) 50 | 51 | ``` 52 | $command = 'DeleteContact'; 53 | $postData = array( 54 | 'contactid' => '1', 55 | ); 56 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 57 | 58 | $results = localAPI($command, $postData, $adminUsername); 59 | print_r($results); 60 | ``` 61 | 62 | 63 | ### Example Response JSON 64 | 65 | ``` 66 | { 67 | "result": "success", 68 | "contactid": "1" 69 | } 70 | ``` 71 | 72 | 73 | ### Error Responses 74 | 75 | Possible error condition responses include: 76 | 77 | * Contact ID Not Found 78 | 79 | 80 | ### Version History 81 | 82 | | Version | Changelog | 83 | | ------- | --------- | 84 | | 1.0 | Initial Version | 85 | -------------------------------------------------------------------------------- /api-reference/deleteoauthcredential.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DeleteOAuthCredential" 3 | toc = true 4 | +++ 5 | 6 | Deletes an OAuth Credential Record. 7 | 8 | Removes OAuth Credential record. This action cannot be undone. 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DeleteOAuthCredential" | Required | 15 | | credentialId | int | The credential id to be deleted | Required | 16 | 17 | ### Response Parameters 18 | 19 | | Parameter | Type | Description | 20 | | --------- | ---- | ----------- | 21 | | result | string | The result of the operation: success or error | 22 | | credentialId | int | The credential id that was deleted | 23 | 24 | 25 | ### Example Request (CURL) 26 | 27 | ``` 28 | $ch = curl_init(); 29 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 30 | curl_setopt($ch, CURLOPT_POST, 1); 31 | curl_setopt($ch, CURLOPT_POSTFIELDS, 32 | http_build_query( 33 | array( 34 | 'action' => 'DeleteOAuthCredential', 35 | // See https://developers.whmcs.com/api/authentication 36 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 37 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 38 | 'credentialId' => '1', 39 | 'responsetype' => 'json', 40 | ) 41 | ) 42 | ); 43 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 44 | $response = curl_exec($ch); 45 | curl_close($ch); 46 | ``` 47 | 48 | 49 | ### Example Request (Local API) 50 | 51 | ``` 52 | $command = 'DeleteOAuthCredential'; 53 | $postData = array( 54 | 'credentialId' => '1', 55 | ); 56 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 57 | 58 | $results = localAPI($command, $postData, $adminUsername); 59 | print_r($results); 60 | ``` 61 | 62 | 63 | ### Example Response JSON 64 | 65 | ``` 66 | { 67 | "result": "success", 68 | "credentialId": "1" 69 | } 70 | ``` 71 | 72 | 73 | ### Error Responses 74 | 75 | Possible error condition responses include: 76 | 77 | * Invalid Credential ID provided. 78 | 79 | 80 | ### Version History 81 | 82 | | Version | Changelog | 83 | | ------- | --------- | 84 | | 1.0 | Initial Version | 85 | -------------------------------------------------------------------------------- /api-reference/deleteorder.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DeleteOrder" 3 | toc = true 4 | +++ 5 | 6 | Deletes a cancelled or fraud order. 7 | 8 | Removes an order from the system. This cannot be undone. This will remove all items associated with the order (services, addons, domains, invoices etc) 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DeleteOrder" | Required | 15 | | orderid | int | The order to be deleted | Required | 16 | 17 | ### Response Parameters 18 | 19 | | Parameter | Type | Description | 20 | | --------- | ---- | ----------- | 21 | | result | string | The result of the operation: success or error | 22 | 23 | 24 | ### Example Request (CURL) 25 | 26 | ``` 27 | $ch = curl_init(); 28 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 29 | curl_setopt($ch, CURLOPT_POST, 1); 30 | curl_setopt($ch, CURLOPT_POSTFIELDS, 31 | http_build_query( 32 | array( 33 | 'action' => 'DeleteOrder', 34 | // See https://developers.whmcs.com/api/authentication 35 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 36 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 37 | 'orderid' => '1', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'DeleteOrder'; 52 | $postData = array( 53 | 'orderid' => '1', 54 | ); 55 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 56 | 57 | $results = localAPI($command, $postData, $adminUsername); 58 | print_r($results); 59 | ``` 60 | 61 | 62 | ### Example Response JSON 63 | 64 | ``` 65 | { 66 | "result": "success" 67 | } 68 | ``` 69 | 70 | 71 | ### Error Responses 72 | 73 | Possible error condition responses include: 74 | 75 | * Order ID not found 76 | * The order status must be in Cancelled or Fraud to be deleted 77 | 78 | 79 | ### Version History 80 | 81 | | Version | Changelog | 82 | | ------- | --------- | 83 | | 1.0 | Initial Version | 84 | -------------------------------------------------------------------------------- /api-reference/deleteprojecttask.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DeleteProjectTask" 3 | toc = true 4 | +++ 5 | 6 | Deletes a task associated with a project 7 | 8 | Removes a task from the system. This cannot be undone 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DeleteProjectTask" | Required | 15 | | projectid | int | The project that owns the task being deleted | Required | 16 | | taskid | int | The task to be deleted | Required | 17 | 18 | ### Response Parameters 19 | 20 | | Parameter | Type | Description | 21 | | --------- | ---- | ----------- | 22 | | result | string | The result of the operation: success or error | 23 | | message | string | Task has been deleted | 24 | 25 | 26 | ### Example Request (CURL) 27 | 28 | ``` 29 | $ch = curl_init(); 30 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 31 | curl_setopt($ch, CURLOPT_POST, 1); 32 | curl_setopt($ch, CURLOPT_POSTFIELDS, 33 | http_build_query( 34 | array( 35 | 'action' => 'DeleteProjectTask', 36 | // See https://developers.whmcs.com/api/authentication 37 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 38 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 39 | 'orderid' => '1', 40 | 'responsetype' => 'json', 41 | ) 42 | ) 43 | ); 44 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 45 | $response = curl_exec($ch); 46 | curl_close($ch); 47 | ``` 48 | 49 | 50 | ### Example Request (Local API) 51 | 52 | ``` 53 | $command = 'DeleteProjectTask'; 54 | $postData = array( 55 | 'orderid' => '1', 56 | ); 57 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 58 | 59 | $results = localAPI($command, $postData, $adminUsername); 60 | print_r($results); 61 | ``` 62 | 63 | 64 | ### Example Response JSON 65 | 66 | ``` 67 | { 68 | "result": "success", 69 | "message": "Task has been deleted" 70 | } 71 | ``` 72 | 73 | 74 | ### Error Responses 75 | 76 | Possible error condition responses include: 77 | 78 | * Project ID is Required 79 | * Task ID is Required 80 | * Project ID Not Found 81 | * Task ID Not Found 82 | 83 | 84 | ### Version History 85 | 86 | | Version | Changelog | 87 | | ------- | --------- | 88 | | 1.0 | Initial Version | 89 | -------------------------------------------------------------------------------- /api-reference/deletequote.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DeleteQuote" 3 | toc = true 4 | +++ 5 | 6 | Deletes a quote. 7 | 8 | Removes a quote from the system. This cannot be undone 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DeleteQuote" | Required | 15 | | quoteid | int | The quote id to be deleted | Required | 16 | 17 | ### Response Parameters 18 | 19 | | Parameter | Type | Description | 20 | | --------- | ---- | ----------- | 21 | | result | string | The result of the operation: success or error | 22 | | result | string | success | 23 | 24 | 25 | ### Example Request (CURL) 26 | 27 | ``` 28 | $ch = curl_init(); 29 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 30 | curl_setopt($ch, CURLOPT_POST, 1); 31 | curl_setopt($ch, CURLOPT_POSTFIELDS, 32 | http_build_query( 33 | array( 34 | 'action' => 'DeleteQuote', 35 | // See https://developers.whmcs.com/api/authentication 36 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 37 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 38 | 'quoteid' => '1', 39 | 'responsetype' => 'json', 40 | ) 41 | ) 42 | ); 43 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 44 | $response = curl_exec($ch); 45 | curl_close($ch); 46 | ``` 47 | 48 | 49 | ### Example Request (Local API) 50 | 51 | ``` 52 | $command = 'DeleteQuote'; 53 | $postData = array( 54 | 'quoteid' => '1', 55 | ); 56 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 57 | 58 | $results = localAPI($command, $postData, $adminUsername); 59 | print_r($results); 60 | ``` 61 | 62 | 63 | ### Example Response JSON 64 | 65 | ``` 66 | { 67 | "result": "error" 68 | } 69 | ``` 70 | 71 | 72 | ### Error Responses 73 | 74 | Possible error condition responses include: 75 | 76 | * Quote ID Not Found 77 | 78 | 79 | ### Version History 80 | 81 | | Version | Changelog | 82 | | ------- | --------- | 83 | | 1.0 | Initial Version | 84 | -------------------------------------------------------------------------------- /api-reference/deleteticket.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DeleteTicket" 3 | toc = true 4 | +++ 5 | 6 | Deletes a ticket. 7 | 8 | Removes a ticket and all replies from the system. This cannot be undone. 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DeleteTicket" | Required | 15 | | ticketid | int | The ticket to be deleted | Required | 16 | 17 | ### Response Parameters 18 | 19 | | Parameter | Type | Description | 20 | | --------- | ---- | ----------- | 21 | | result | string | The result of the operation: success or error | 22 | 23 | 24 | ### Example Request (CURL) 25 | 26 | ``` 27 | $ch = curl_init(); 28 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 29 | curl_setopt($ch, CURLOPT_POST, 1); 30 | curl_setopt($ch, CURLOPT_POSTFIELDS, 31 | http_build_query( 32 | array( 33 | 'action' => 'DeleteTicket', 34 | // See https://developers.whmcs.com/api/authentication 35 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 36 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 37 | 'ticketid' => '1', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'DeleteTicket'; 52 | $postData = array( 53 | 'ticketid' => '1', 54 | ); 55 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 56 | 57 | $results = localAPI($command, $postData, $adminUsername); 58 | print_r($results); 59 | ``` 60 | 61 | 62 | ### Example Response JSON 63 | 64 | ``` 65 | { 66 | "result": "success" 67 | } 68 | ``` 69 | 70 | 71 | ### Error Responses 72 | 73 | Possible error condition responses include: 74 | 75 | * Ticket ID not found 76 | 77 | 78 | ### Version History 79 | 80 | | Version | Changelog | 81 | | ------- | --------- | 82 | | 1.0 | Initial Version | 83 | -------------------------------------------------------------------------------- /api-reference/deleteticketnote.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DeleteTicketNote" 3 | toc = true 4 | +++ 5 | 6 | Deletes a ticket note. 7 | 8 | Removes a ticket note from the system. This cannot be undone. 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DeleteTicketNote" | Required | 15 | | noteid | int | The ticket note to be deleted | Required | 16 | 17 | ### Response Parameters 18 | 19 | | Parameter | Type | Description | 20 | | --------- | ---- | ----------- | 21 | | result | string | The result of the operation: success or error | 22 | 23 | 24 | ### Example Request (CURL) 25 | 26 | ``` 27 | $ch = curl_init(); 28 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 29 | curl_setopt($ch, CURLOPT_POST, 1); 30 | curl_setopt($ch, CURLOPT_POSTFIELDS, 31 | http_build_query( 32 | array( 33 | 'action' => 'DeleteTicketNote', 34 | // See https://developers.whmcs.com/api/authentication 35 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 36 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 37 | 'noteid' => '1', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'DeleteTicketNote'; 52 | $postData = array( 53 | 'noteid' => '1', 54 | ); 55 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 56 | 57 | $results = localAPI($command, $postData, $adminUsername); 58 | print_r($results); 59 | ``` 60 | 61 | 62 | ### Example Response JSON 63 | 64 | ``` 65 | { 66 | "result": "success" 67 | } 68 | ``` 69 | 70 | 71 | ### Error Responses 72 | 73 | Possible error condition responses include: 74 | 75 | * Note ID Not Found 76 | 77 | 78 | ### Version History 79 | 80 | | Version | Changelog | 81 | | ------- | --------- | 82 | | 1.0 | Initial Version | 83 | -------------------------------------------------------------------------------- /api-reference/deleteticketreply.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DeleteTicketReply" 3 | toc = true 4 | +++ 5 | 6 | Deletes a ticket reply. 7 | 8 | Removes a specific ticket reply from the system. This cannot be undone. 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DeleteTicketReply" | Required | 15 | | ticketid | int | The ticket the reply belongs to | Required | 16 | | replyid | int | The ticket reply to be deleted | Required | 17 | 18 | ### Response Parameters 19 | 20 | | Parameter | Type | Description | 21 | | --------- | ---- | ----------- | 22 | | result | string | The result of the operation: success or error | 23 | 24 | 25 | ### Example Request (CURL) 26 | 27 | ``` 28 | $ch = curl_init(); 29 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 30 | curl_setopt($ch, CURLOPT_POST, 1); 31 | curl_setopt($ch, CURLOPT_POSTFIELDS, 32 | http_build_query( 33 | array( 34 | 'action' => 'DeleteTicketReply', 35 | // See https://developers.whmcs.com/api/authentication 36 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 37 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 38 | 'ticketid' => '1', 39 | 'replyid' => '1', 40 | 'responsetype' => 'json', 41 | ) 42 | ) 43 | ); 44 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 45 | $response = curl_exec($ch); 46 | curl_close($ch); 47 | ``` 48 | 49 | 50 | ### Example Request (Local API) 51 | 52 | ``` 53 | $command = 'DeleteTicketReply'; 54 | $postData = array( 55 | 'ticketid' => '1', 56 | 'replyid' => '1', 57 | ); 58 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 59 | 60 | $results = localAPI($command, $postData, $adminUsername); 61 | print_r($results); 62 | ``` 63 | 64 | 65 | ### Example Response JSON 66 | 67 | ``` 68 | { 69 | "result": "success" 70 | } 71 | ``` 72 | 73 | 74 | ### Error Responses 75 | 76 | Possible error condition responses include: 77 | 78 | * Ticket ID Required 79 | * Reply ID Required 80 | * Ticket ID Not Found 81 | * Reply ID Not Found 82 | 83 | 84 | ### Version History 85 | 86 | | Version | Changelog | 87 | | ------- | --------- | 88 | | 7.10.0 | Initial Version | 89 | -------------------------------------------------------------------------------- /api-reference/deleteuserclient.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DeleteUserClient" 3 | toc = true 4 | +++ 5 | 6 | Delete relationship between user and client. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "DeleteUserClient" | Required | 13 | | user_id | int | The id of the user to remove from the client | Required | 14 | | client_id | int | The id of the client to remove the user from | Required | 15 | 16 | ### Response Parameters 17 | 18 | | Parameter | Type | Description | 19 | | --------- | ---- | ----------- | 20 | | result | string | The result of the operation: success or error | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'DeleteUserClient', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'user_id' => '1', 37 | 'client_id' => '1', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'DeleteUserClient'; 52 | $postData = array( 53 | 'user_id' => '1', 54 | 'client_id' => '1', 55 | ); 56 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 57 | 58 | $results = localAPI($command, $postData, $adminUsername); 59 | print_r($results); 60 | ``` 61 | 62 | 63 | ### Example Response JSON 64 | 65 | ``` 66 | { 67 | "result": "success" 68 | } 69 | ``` 70 | 71 | 72 | ### Error Responses 73 | 74 | Possible error condition responses include: 75 | 76 | * Invalid user id 77 | * Invalid client id 78 | * User is not associated with client 79 | * You cannot remove the account owner 80 | 81 | 82 | ### Version History 83 | 84 | | Version | Changelog | 85 | | ------- | --------- | 86 | | 8.0.0 | Initial Version | 87 | -------------------------------------------------------------------------------- /api-reference/domaingetlockingstatus.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DomainGetLockingStatus" 3 | toc = true 4 | +++ 5 | 6 | Obtains the current lock status of the domain. 7 | 8 | Connects to the registrar and obtains the current lock status of the domain 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DomainGetLockingStatus" | Required | 15 | | domainid | int | The id of the domain to obtain the lock status for | Required | 16 | 17 | ### Response Parameters 18 | 19 | | Parameter | Type | Description | 20 | | --------- | ---- | ----------- | 21 | | result | string | The result of the operation: success or error | 22 | | lockstatus | string | The current status of the lock. | 23 | 24 | 25 | ### Example Request (CURL) 26 | 27 | ``` 28 | $ch = curl_init(); 29 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 30 | curl_setopt($ch, CURLOPT_POST, 1); 31 | curl_setopt($ch, CURLOPT_POSTFIELDS, 32 | http_build_query( 33 | array( 34 | 'action' => 'DomainGetLockingStatus', 35 | // See https://developers.whmcs.com/api/authentication 36 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 37 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 38 | 'domainid' => '1', 39 | 'responsetype' => 'json', 40 | ) 41 | ) 42 | ); 43 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 44 | $response = curl_exec($ch); 45 | curl_close($ch); 46 | ``` 47 | 48 | 49 | ### Example Request (Local API) 50 | 51 | ``` 52 | $command = 'DomainGetLockingStatus'; 53 | $postData = array( 54 | 'domainid' => '1', 55 | ); 56 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 57 | 58 | $results = localAPI($command, $postData, $adminUsername); 59 | print_r($results); 60 | ``` 61 | 62 | 63 | ### Example Response JSON 64 | 65 | ``` 66 | { 67 | "result": "success", 68 | "lockstatus": "locked" 69 | } 70 | ``` 71 | 72 | 73 | ### Error Responses 74 | 75 | Possible error condition responses include: 76 | 77 | * Domain ID Not Found 78 | 79 | 80 | ### Version History 81 | 82 | | Version | Changelog | 83 | | ------- | --------- | 84 | | 1.0 | Initial Version | 85 | -------------------------------------------------------------------------------- /api-reference/domainrelease.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DomainRelease" 3 | toc = true 4 | +++ 5 | 6 | Sends the Release command to the registrar for the domain to a new tag 7 | 8 | Connects to the registrar and attempts to release the domain. 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DomainRelease" | Required | 15 | | domainid | int | The id of the domain to be released *recommended* | Optional | 16 | | domain | string | The domain name to be released. This or $domainid is required | Optional | 17 | | newtag | string | The receiving tag for the domain | Required | 18 | 19 | ### Response Parameters 20 | 21 | | Parameter | Type | Description | 22 | | --------- | ---- | ----------- | 23 | | result | string | The result of the operation: success or error | 24 | 25 | 26 | ### Example Request (CURL) 27 | 28 | ``` 29 | $ch = curl_init(); 30 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 31 | curl_setopt($ch, CURLOPT_POST, 1); 32 | curl_setopt($ch, CURLOPT_POSTFIELDS, 33 | http_build_query( 34 | array( 35 | 'action' => 'DomainRelease', 36 | // See https://developers.whmcs.com/api/authentication 37 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 38 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 39 | 'domainid' => '1', 40 | 'newtag' => 'ENOM', 41 | 'responsetype' => 'json', 42 | ) 43 | ) 44 | ); 45 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 46 | $response = curl_exec($ch); 47 | curl_close($ch); 48 | ``` 49 | 50 | 51 | ### Example Request (Local API) 52 | 53 | ``` 54 | $command = 'DomainRelease'; 55 | $postData = array( 56 | 'domainid' => '1', 57 | 'newtag' => 'ENOM', 58 | ); 59 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 60 | 61 | $results = localAPI($command, $postData, $adminUsername); 62 | print_r($results); 63 | ``` 64 | 65 | 66 | ### Example Response JSON 67 | 68 | ``` 69 | { 70 | "result": "success" 71 | } 72 | ``` 73 | 74 | 75 | ### Error Responses 76 | 77 | Possible error condition responses include: 78 | 79 | * Domain Not Found 80 | * Registrar Error Message 81 | 82 | 83 | ### Version History 84 | 85 | | Version | Changelog | 86 | | ------- | --------- | 87 | | 1.0 | Initial Version | 88 | -------------------------------------------------------------------------------- /api-reference/domainrenew.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DomainRenew" 3 | toc = true 4 | +++ 5 | 6 | Sends the Renew command to the registrar for the domain 7 | 8 | Connects to the registrar and attempts to renew the domain. 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DomainRenew" | Required | 15 | | domainid | int | The id of the domain to be renewed *recommended* | Optional | 16 | | domain | string | The domain name to be renewed. This or $domainid is required | Optional | 17 | | regperiod | int | How long to renew the domain for. Defaults to the current stored value. | Optional | 18 | 19 | ### Response Parameters 20 | 21 | | Parameter | Type | Description | 22 | | --------- | ---- | ----------- | 23 | | result | string | The result of the operation: success or error | 24 | 25 | 26 | ### Example Request (CURL) 27 | 28 | ``` 29 | $ch = curl_init(); 30 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 31 | curl_setopt($ch, CURLOPT_POST, 1); 32 | curl_setopt($ch, CURLOPT_POSTFIELDS, 33 | http_build_query( 34 | array( 35 | 'action' => 'DomainRenew', 36 | // See https://developers.whmcs.com/api/authentication 37 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 38 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 39 | 'domainid' => '1', 40 | 'responsetype' => 'json', 41 | ) 42 | ) 43 | ); 44 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 45 | $response = curl_exec($ch); 46 | curl_close($ch); 47 | ``` 48 | 49 | 50 | ### Example Request (Local API) 51 | 52 | ``` 53 | $command = 'DomainRenew'; 54 | $postData = array( 55 | 'domainid' => '1', 56 | ); 57 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 58 | 59 | $results = localAPI($command, $postData, $adminUsername); 60 | print_r($results); 61 | ``` 62 | 63 | 64 | ### Example Response JSON 65 | 66 | ``` 67 | { 68 | "result": "success" 69 | } 70 | ``` 71 | 72 | 73 | ### Error Responses 74 | 75 | Possible error condition responses include: 76 | 77 | * Domain Not Found 78 | * Registrar Error Message 79 | 80 | 81 | ### Version History 82 | 83 | | Version | Changelog | 84 | | ------- | --------- | 85 | | 1.0 | Initial Version | 86 | -------------------------------------------------------------------------------- /api-reference/domaintoggleidprotect.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DomainToggleIdProtect" 3 | toc = true 4 | +++ 5 | 6 | Sends the Toggle ID Protect command to the registrar for the domain 7 | 8 | Connects to the registrar and attempts to toggle the ID Protect state 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DomainToggleIdProtect" | Required | 15 | | domainid | int | The id of the domain to toggle ID Protection for | Required | 16 | | idprotect | bool | Should ID Protection be turned on | Optional | 17 | 18 | ### Response Parameters 19 | 20 | | Parameter | Type | Description | 21 | | --------- | ---- | ----------- | 22 | | result | string | The result of the operation: success or error | 23 | 24 | 25 | ### Example Request (CURL) 26 | 27 | ``` 28 | $ch = curl_init(); 29 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 30 | curl_setopt($ch, CURLOPT_POST, 1); 31 | curl_setopt($ch, CURLOPT_POSTFIELDS, 32 | http_build_query( 33 | array( 34 | 'action' => 'DomainToggleIdProtect', 35 | // See https://developers.whmcs.com/api/authentication 36 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 37 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 38 | 'domainid' => '1', 39 | 'idprotect' => true, 40 | 'responsetype' => 'json', 41 | ) 42 | ) 43 | ); 44 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 45 | $response = curl_exec($ch); 46 | curl_close($ch); 47 | ``` 48 | 49 | 50 | ### Example Request (Local API) 51 | 52 | ``` 53 | $command = 'DomainToggleIdProtect'; 54 | $postData = array( 55 | 'domainid' => '1', 56 | 'idprotect' => true, 57 | ); 58 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 59 | 60 | $results = localAPI($command, $postData, $adminUsername); 61 | print_r($results); 62 | ``` 63 | 64 | 65 | ### Example Response JSON 66 | 67 | ``` 68 | { 69 | "result": "success" 70 | } 71 | ``` 72 | 73 | 74 | ### Error Responses 75 | 76 | Possible error condition responses include: 77 | 78 | * Domain ID Not Found 79 | * Registrar Error Message 80 | 81 | 82 | ### Version History 83 | 84 | | Version | Changelog | 85 | | ------- | --------- | 86 | | 1.0 | Initial Version | 87 | -------------------------------------------------------------------------------- /api-reference/domaintransfer.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DomainTransfer" 3 | toc = true 4 | +++ 5 | 6 | Sends the Transfer command to the registrar for the domain 7 | 8 | Connects to the registrar and attempts to start the transfer process. 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "DomainTransfer" | Required | 15 | | domainid | int | The id of the domain to be transferred *recommended* | Optional | 16 | | domain | string | The domain name to be transferred. This or $domainid is required | Optional | 17 | | eppcode | int | Provide a new EPP Code for the Transfer Request | Optional | 18 | 19 | ### Response Parameters 20 | 21 | | Parameter | Type | Description | 22 | | --------- | ---- | ----------- | 23 | | result | string | The result of the operation: success or error | 24 | 25 | 26 | ### Example Request (CURL) 27 | 28 | ``` 29 | $ch = curl_init(); 30 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 31 | curl_setopt($ch, CURLOPT_POST, 1); 32 | curl_setopt($ch, CURLOPT_POSTFIELDS, 33 | http_build_query( 34 | array( 35 | 'action' => 'DomainTransfer', 36 | // See https://developers.whmcs.com/api/authentication 37 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 38 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 39 | 'domainid' => '1', 40 | 'responsetype' => 'json', 41 | ) 42 | ) 43 | ); 44 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 45 | $response = curl_exec($ch); 46 | curl_close($ch); 47 | ``` 48 | 49 | 50 | ### Example Request (Local API) 51 | 52 | ``` 53 | $command = 'DomainTransfer'; 54 | $postData = array( 55 | 'domainid' => '1', 56 | ); 57 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 58 | 59 | $results = localAPI($command, $postData, $adminUsername); 60 | print_r($results); 61 | ``` 62 | 63 | 64 | ### Example Response JSON 65 | 66 | ``` 67 | { 68 | "result": "success" 69 | } 70 | ``` 71 | 72 | 73 | ### Error Responses 74 | 75 | Possible error condition responses include: 76 | 77 | * Domain Not Found 78 | * Registrar Error Message 79 | 80 | 81 | ### Version History 82 | 83 | | Version | Changelog | 84 | | ------- | --------- | 85 | | 1.0 | Initial Version | 86 | -------------------------------------------------------------------------------- /api-reference/domainwhois.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "DomainWhois" 3 | toc = true 4 | +++ 5 | 6 | Retrieve domain whois information. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "DomainWhois" | Required | 13 | | domain | string | The domain name to lookup | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | | status | string | The registration status: available or unavailable | 21 | | whois | string | Whois server response | 22 | 23 | 24 | ### Example Request (CURL) 25 | 26 | ``` 27 | $ch = curl_init(); 28 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 29 | curl_setopt($ch, CURLOPT_POST, 1); 30 | curl_setopt($ch, CURLOPT_POSTFIELDS, 31 | http_build_query( 32 | array( 33 | 'action' => 'DomainWhois', 34 | // See https://developers.whmcs.com/api/authentication 35 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 36 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 37 | 'domain' => 'example.com', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'DomainWhois'; 52 | $postData = array( 53 | 'domain' => 'example.com', 54 | ); 55 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 56 | 57 | $results = localAPI($command, $postData, $adminUsername); 58 | print_r($results); 59 | ``` 60 | 61 | 62 | ### Example Response JSON 63 | 64 | ``` 65 | { 66 | "result": "success", 67 | "status": "unavailable", 68 | "whois": "xxx" 69 | } 70 | ``` 71 | 72 | 73 | ### Error Responses 74 | 75 | Possible error condition responses include: 76 | 77 | * Domain not valid 78 | * The given TLD is not supported for WHOIS lookups 79 | 80 | 81 | ### Version History 82 | 83 | | Version | Changelog | 84 | | ------- | --------- | 85 | | 1.0 | Initial Version | 86 | -------------------------------------------------------------------------------- /api-reference/encryptpassword.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "EncryptPassword" 3 | toc = true 4 | +++ 5 | 6 | Encrypt a string. 7 | 8 | Encrypting the same string twice will return different values. You will need to decrypt an encrypted string to compare values. 9 | 10 | ### Request Parameters 11 | 12 | | Parameter | Type | Description | Required | 13 | | --------- | ---- | ----------- | -------- | 14 | | action | string | "EncryptPassword" | Required | 15 | | password2 | string | The string to encrypt | Required | 16 | 17 | ### Response Parameters 18 | 19 | | Parameter | Type | Description | 20 | | --------- | ---- | ----------- | 21 | | result | string | The result of the operation: success or error | 22 | 23 | 24 | ### Example Request (CURL) 25 | 26 | ``` 27 | $ch = curl_init(); 28 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 29 | curl_setopt($ch, CURLOPT_POST, 1); 30 | curl_setopt($ch, CURLOPT_POSTFIELDS, 31 | http_build_query( 32 | array( 33 | 'action' => 'EncryptPassword', 34 | // See https://developers.whmcs.com/api/authentication 35 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 36 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 37 | 'password2' => 'teststring', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'EncryptPassword'; 52 | $postData = array( 53 | 'password2' => 'teststring', 54 | ); 55 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 56 | 57 | $results = localAPI($command, $postData, $adminUsername); 58 | print_r($results); 59 | ``` 60 | 61 | 62 | ### Example Response JSON 63 | 64 | ``` 65 | { 66 | "result": "success", 67 | "password": "vNRQzRPKQA6obJpHMHCBivS0D9\/Pf532oArYvewP" 68 | } 69 | ``` 70 | 71 | 72 | ### Version History 73 | 74 | | Version | Changelog | 75 | | ------- | --------- | 76 | | 1.0 | Initial Version | 77 | -------------------------------------------------------------------------------- /api-reference/fraudorder.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "FraudOrder" 3 | toc = true 4 | +++ 5 | 6 | Marks an order as fraudulent. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "FraudOrder" | Required | 13 | | orderid | int | The Order ID to set as fraud | Required | 14 | | cancelsub | bool | Pass as true to cancel any PayPal Subscription(s) associated with the products & services that belong to the given order. | Optional | 15 | 16 | ### Response Parameters 17 | 18 | | Parameter | Type | Description | 19 | | --------- | ---- | ----------- | 20 | | result | string | The result of the operation: success or error | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'FraudOrder', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'orderid' => '1', 37 | 'cancelsub' => '1', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'FraudOrder'; 52 | $postData = array( 53 | 'orderid' => '1', 54 | 'cancelsub' => '1', 55 | ); 56 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 57 | 58 | $results = localAPI($command, $postData, $adminUsername); 59 | print_r($results); 60 | ``` 61 | 62 | 63 | ### Example Response JSON 64 | 65 | ``` 66 | { 67 | "result": "success" 68 | } 69 | ``` 70 | 71 | 72 | ### Error Responses 73 | 74 | Possible error condition responses include: 75 | 76 | * Order ID Not Found 77 | * Subscription Cancellation Failed - Please check the gateway log for further information 78 | 79 | 80 | ### Version History 81 | 82 | | Version | Changelog | 83 | | ------- | --------- | 84 | | 1.0 | Initial Version | 85 | -------------------------------------------------------------------------------- /api-reference/getclientpassword.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "GetClientPassword" 3 | toc = true 4 | +++ 5 | 6 | Obtain the encrypted client password 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "GetClientPassword" | Required | 13 | | userid | int | The userid to obtain the password for | Optional | 14 | | email | string | The email address to obtain the password for | Optional | 15 | 16 | ### Response Parameters 17 | 18 | | Parameter | Type | Description | 19 | | --------- | ---- | ----------- | 20 | | result | string | The result of the operation: success or error | 21 | | password | string | The clients encrypted password | 22 | 23 | 24 | ### Example Request (CURL) 25 | 26 | ``` 27 | $ch = curl_init(); 28 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 29 | curl_setopt($ch, CURLOPT_POST, 1); 30 | curl_setopt($ch, CURLOPT_POSTFIELDS, 31 | http_build_query( 32 | array( 33 | 'action' => 'GetClientPassword', 34 | // See https://developers.whmcs.com/api/authentication 35 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 36 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 37 | 'userid' => '1', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'GetClientPassword'; 52 | $postData = array( 53 | 'userid' => '1', 54 | ); 55 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 56 | 57 | $results = localAPI($command, $postData, $adminUsername); 58 | print_r($results); 59 | ``` 60 | 61 | 62 | ### Example Response JSON 63 | 64 | ``` 65 | { 66 | "result": "success", 67 | "password": "$2y$10$17X1fBPpamALcMA9KMiFneH4FYpMkkmFGDxlkxbjGeSnfH8sLqixa" 68 | } 69 | ``` 70 | 71 | 72 | ### Error Responses 73 | 74 | Possible error condition responses include: 75 | 76 | * Client ID Not Found 77 | 78 | 79 | ### Version History 80 | 81 | | Version | Changelog | 82 | | ------- | --------- | 83 | | 1.0 | Initial Version | 84 | | 8.0 | Deprecated. | 85 | -------------------------------------------------------------------------------- /api-reference/getconfigurationvalue.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "GetConfigurationValue" 3 | toc = true 4 | +++ 5 | 6 | Retrieve a System Configuration Value. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "GetConfigurationValue" | Required | 13 | | setting | string | The name of the setting to be obtained | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | | setting | string | The setting name | 21 | | value | string | The setting value | 22 | 23 | 24 | ### Example Request (CURL) 25 | 26 | ``` 27 | $ch = curl_init(); 28 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 29 | curl_setopt($ch, CURLOPT_POST, 1); 30 | curl_setopt($ch, CURLOPT_POSTFIELDS, 31 | http_build_query( 32 | array( 33 | 'action' => 'GetConfigurationValue', 34 | // See https://developers.whmcs.com/api/authentication 35 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 36 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 37 | 'setting' => 'SystemURL', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'GetConfigurationValue'; 52 | $postData = array( 53 | 'setting' => 'SystemURL', 54 | ); 55 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 56 | 57 | $results = localAPI($command, $postData, $adminUsername); 58 | print_r($results); 59 | ``` 60 | 61 | 62 | ### Example Response JSON 63 | 64 | ``` 65 | { 66 | "result": "success", 67 | "setting": "SystemURL", 68 | "value": "http:\/\/www.example.com\/whmcs\/" 69 | } 70 | ``` 71 | 72 | 73 | ### Error Responses 74 | 75 | Possible error condition responses include: 76 | 77 | * Parameter setting is required 78 | * Invalid name for parameter setting 79 | 80 | 81 | ### Version History 82 | 83 | | Version | Changelog | 84 | | ------- | --------- | 85 | | 7.0.0-beta.1 | Initial Version | 86 | -------------------------------------------------------------------------------- /api-reference/getcurrencies.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "GetCurrencies" 3 | toc = true 4 | +++ 5 | 6 | Obtain the Currencies configured in the System 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "GetCurrencies" | Required | 13 | 14 | ### Response Parameters 15 | 16 | | Parameter | Type | Description | 17 | | --------- | ---- | ----------- | 18 | | result | string | The result of the operation: success or error | 19 | | totalresults | int | The total number of results available | 20 | | currencies | array | The currency entries returned | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'GetCurrencies', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'GetCurrencies'; 50 | $postData = array( 51 | ); 52 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 53 | 54 | $results = localAPI($command, $postData, $adminUsername); 55 | print_r($results); 56 | ``` 57 | 58 | 59 | ### Example Response JSON 60 | 61 | ``` 62 | { 63 | "result": "success", 64 | "totalresults": "1", 65 | "currencies[currency][0][id]": "1", 66 | "currencies[currency][0][code]": "USD", 67 | "currencies[currency][0][prefix]": "$", 68 | "currencies[currency][0][suffix]": " USD", 69 | "currencies[currency][0][format]": "1", 70 | "currencies[currency][0][rate]": "1.00000" 71 | } 72 | ``` 73 | 74 | 75 | ### Version History 76 | 77 | | Version | Changelog | 78 | | ------- | --------- | 79 | | 1.0 | Initial Version | 80 | -------------------------------------------------------------------------------- /api-reference/gethealthstatus.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "GetHealthStatus" 3 | toc = true 4 | +++ 5 | 6 | Get health status. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "GetHealthStatus" | Required | 13 | | fetchStatus | bool | Pass as true to attempt to fetch server status values. | Optional | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'GetHealthStatus', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'fetchStatus' => false, 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'GetHealthStatus'; 50 | $postData = array( 51 | 'fetchStatus' => false, 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success" 65 | } 66 | ``` 67 | 68 | 69 | ### Version History 70 | 71 | | Version | Changelog | 72 | | ------- | --------- | 73 | | 1.0 | Initial Version | 74 | -------------------------------------------------------------------------------- /api-reference/getpaymentmethods.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "GetPaymentMethods" 3 | toc = true 4 | +++ 5 | 6 | Retrieve Activated Payment Methods 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "GetPaymentMethods" | Required | 13 | 14 | ### Response Parameters 15 | 16 | | Parameter | Type | Description | 17 | | --------- | ---- | ----------- | 18 | | result | string | The result of the operation: success or error | 19 | | totalresults | int | The total number of results available | 20 | | paymentmethods | array | An array of available payment methods | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'GetPaymentMethods', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'GetPaymentMethods'; 50 | $postData = array( 51 | ); 52 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 53 | 54 | $results = localAPI($command, $postData, $adminUsername); 55 | print_r($results); 56 | ``` 57 | 58 | 59 | ### Example Response JSON 60 | 61 | ``` 62 | { 63 | "result": "success", 64 | "totalresults": 2, 65 | "paymentmethods": { 66 | "paymentmethod": [ 67 | { 68 | "module": "paypal", 69 | "displayname": "PayPal" 70 | }, 71 | { 72 | "module": "authorize", 73 | "displayname": "Credit Card" 74 | } 75 | ] 76 | } 77 | } 78 | ``` 79 | 80 | 81 | ### Version History 82 | 83 | | Version | Changelog | 84 | | ------- | --------- | 85 | | 1.0 | Initial Version | 86 | -------------------------------------------------------------------------------- /api-reference/getpermissionslist.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "GetPermissionsList" 3 | toc = true 4 | +++ 5 | 6 | Retrieve a list of permissions that can be used when creating a user 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "GetPermissionsList" | Required | 13 | 14 | ### Response Parameters 15 | 16 | | Parameter | Type | Description | 17 | | --------- | ---- | ----------- | 18 | | result | string | The result of the operation: success or error | 19 | 20 | 21 | ### Example Request (CURL) 22 | 23 | ``` 24 | $ch = curl_init(); 25 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 26 | curl_setopt($ch, CURLOPT_POST, 1); 27 | curl_setopt($ch, CURLOPT_POSTFIELDS, 28 | http_build_query( 29 | array( 30 | 'action' => 'GetPermissionsList', 31 | // See https://developers.whmcs.com/api/authentication 32 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 33 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 34 | 'responsetype' => 'json', 35 | ) 36 | ) 37 | ); 38 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 39 | $response = curl_exec($ch); 40 | curl_close($ch); 41 | ``` 42 | 43 | 44 | ### Example Request (Local API) 45 | 46 | ``` 47 | $command = 'GetPermissionsList'; 48 | $postData = array( 49 | ); 50 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 51 | 52 | $results = localAPI($command, $postData, $adminUsername); 53 | print_r($results); 54 | ``` 55 | 56 | 57 | ### Example Response JSON 58 | 59 | ``` 60 | { 61 | "status": "success", 62 | "permissions": { 63 | "permission": [ 64 | "profile", 65 | "contacts", 66 | "products", 67 | "manageproducts", 68 | "productsso", 69 | "domains", 70 | "managedomains", 71 | "invoices", 72 | "quotes", 73 | "tickets", 74 | "affiliates", 75 | "emails", 76 | "orders" 77 | ] 78 | } 79 | } 80 | ``` 81 | 82 | 83 | ### Version History 84 | 85 | | Version | Changelog | 86 | | ------- | --------- | 87 | | 1.0 | Initial Version | 88 | -------------------------------------------------------------------------------- /api-reference/getregistrars.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "GetRegistrars" 3 | toc = true 4 | +++ 5 | 6 | Get Registrars. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "GetRegistrars" | Required | 13 | 14 | ### Response Parameters 15 | 16 | | Parameter | Type | Description | 17 | | --------- | ---- | ----------- | 18 | | result | string | The result of the operation: success or error | 19 | | registrars | array | An array of active registrars in the system. | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'GetRegistrars', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'responsetype' => 'json', 36 | ) 37 | ) 38 | ); 39 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 40 | $response = curl_exec($ch); 41 | curl_close($ch); 42 | ``` 43 | 44 | 45 | ### Example Request (Local API) 46 | 47 | ``` 48 | $command = 'GetRegistrars'; 49 | $postData = array( 50 | ); 51 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 52 | 53 | $results = localAPI($command, $postData, $adminUsername); 54 | print_r($results); 55 | ``` 56 | 57 | 58 | ### Example Response JSON 59 | 60 | ``` 61 | [] 62 | ``` 63 | 64 | 65 | ### Version History 66 | 67 | | Version | Changelog | 68 | | ------- | --------- | 69 | | 8.1.1 | Initial Version | 70 | -------------------------------------------------------------------------------- /api-reference/getstaffonline.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "GetStaffOnline" 3 | toc = true 4 | +++ 5 | 6 | Retrieve a list of currently logged in admin users. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "GetStaffOnline" | Required | 13 | 14 | ### Response Parameters 15 | 16 | | Parameter | Type | Description | 17 | | --------- | ---- | ----------- | 18 | | result | string | The result of the operation: success or error | 19 | | totalresults | int | Total number of users online | 20 | | staffonline | array | An array of online staff and login details | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'GetStaffOnline', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'GetStaffOnline'; 50 | $postData = array( 51 | ); 52 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 53 | 54 | $results = localAPI($command, $postData, $adminUsername); 55 | print_r($results); 56 | ``` 57 | 58 | 59 | ### Example Response JSON 60 | 61 | ``` 62 | { 63 | "result": "success", 64 | "totalresults": 1, 65 | "staffonline": { 66 | "staff": [ 67 | { 68 | "adminusername": "Admin", 69 | "logintime": "2016-01-01 16:11:15", 70 | "ipaddress": "1.2.3.4", 71 | "lastvisit": "2016-01-01 16:15:28" 72 | } 73 | ] 74 | } 75 | } 76 | ``` 77 | 78 | 79 | ### Version History 80 | 81 | | Version | Changelog | 82 | | ------- | --------- | 83 | | 1.0 | Initial Version | 84 | -------------------------------------------------------------------------------- /api-reference/getsupportdepartments.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "GetSupportDepartments" 3 | toc = true 4 | +++ 5 | 6 | Get the support departments and associated ticket counts 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "GetSupportDepartments" | Required | 13 | | ignore_dept_assignments | bool | Pass as true to not adhere to the departments the API user is a member of. | Optional | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | | totalresults | int | The total number of results available | 21 | | departments | array | An array of department information | 22 | 23 | 24 | ### Example Request (CURL) 25 | 26 | ``` 27 | $ch = curl_init(); 28 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 29 | curl_setopt($ch, CURLOPT_POST, 1); 30 | curl_setopt($ch, CURLOPT_POSTFIELDS, 31 | http_build_query( 32 | array( 33 | 'action' => 'GetSupportDepartments', 34 | // See https://developers.whmcs.com/api/authentication 35 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 36 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 37 | 'responsetype' => 'json', 38 | ) 39 | ) 40 | ); 41 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 42 | $response = curl_exec($ch); 43 | curl_close($ch); 44 | ``` 45 | 46 | 47 | ### Example Request (Local API) 48 | 49 | ``` 50 | $command = 'GetSupportDepartments'; 51 | $postData = array( 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success", 65 | "totalresults": 1, 66 | "departments": { 67 | "department": [ 68 | { 69 | "id": "1", 70 | "name": "Sample Support Department", 71 | "awaitingreply": "0", 72 | "opentickets": "0" 73 | } 74 | ] 75 | } 76 | } 77 | ``` 78 | 79 | 80 | ### Version History 81 | 82 | | Version | Changelog | 83 | | ------- | --------- | 84 | | 1.0 | Initial Version | 85 | -------------------------------------------------------------------------------- /api-reference/gettodoitems.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "GetToDoItems" 3 | toc = true 4 | +++ 5 | 6 | Get To-Do List Items. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "GetToDoItems" | Required | 13 | | limitstart | int | The offset for the returned log data (default: 0) | Optional | 14 | | limitnum | int | The number of records to return (default: 25) | Optional | 15 | | status | string | Status to filter for. Possible values include: Incomplete, New, Pending, In Progress, Completed | Optional | 16 | 17 | ### Response Parameters 18 | 19 | | Parameter | Type | Description | 20 | | --------- | ---- | ----------- | 21 | | result | string | The result of the operation: success or error | 22 | | totalresults | int | The total number of results available | 23 | | startnumber | int | The starting number for the returned results | 24 | | items | array | The to-do list entries | 25 | 26 | 27 | ### Example Request (CURL) 28 | 29 | ``` 30 | $ch = curl_init(); 31 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 32 | curl_setopt($ch, CURLOPT_POST, 1); 33 | curl_setopt($ch, CURLOPT_POSTFIELDS, 34 | http_build_query( 35 | array( 36 | 'action' => 'GetToDoItems', 37 | // See https://developers.whmcs.com/api/authentication 38 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 39 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 40 | 'status' => 'Incomplete', 41 | 'responsetype' => 'json', 42 | ) 43 | ) 44 | ); 45 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 46 | $response = curl_exec($ch); 47 | curl_close($ch); 48 | ``` 49 | 50 | 51 | ### Example Request (Local API) 52 | 53 | ``` 54 | $command = 'GetToDoItems'; 55 | $postData = array( 56 | 'status' => 'Incomplete', 57 | ); 58 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 59 | 60 | $results = localAPI($command, $postData, $adminUsername); 61 | print_r($results); 62 | ``` 63 | 64 | 65 | ### Example Response JSON 66 | 67 | ``` 68 | { 69 | "result": "success", 70 | "totalresults": "0", 71 | "startnumber": "0" 72 | } 73 | ``` 74 | 75 | 76 | ### Version History 77 | 78 | | Version | Changelog | 79 | | ------- | --------- | 80 | | 1.0 | Initial Version | 81 | -------------------------------------------------------------------------------- /api-reference/getuserpermissions.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "GetUserPermissions" 3 | toc = true 4 | +++ 5 | 6 | Provide the permissions of a user for a client. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "GetUserPermissions" | Required | 13 | | user_id | int | The id of the user to retrieve the permissions for | Required | 14 | | client_id | int | The id of the client to retrieve the permissions for | Required | 15 | 16 | ### Response Parameters 17 | 18 | | Parameter | Type | Description | 19 | | --------- | ---- | ----------- | 20 | | result | string | The result of the operation: success or error | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'GetUserPermissions', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'user_id' => '1', 37 | 'client_id' => '1', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'GetUserPermissions'; 52 | $postData = array( 53 | 'user_id' => '1', 54 | 'client_id' => '1', 55 | ); 56 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 57 | 58 | $results = localAPI($command, $postData, $adminUsername); 59 | print_r($results); 60 | ``` 61 | 62 | 63 | ### Example Response JSON 64 | 65 | ``` 66 | { 67 | "result": "success" 68 | } 69 | ``` 70 | 71 | 72 | ### Error Responses 73 | 74 | Possible error condition responses include: 75 | 76 | * Invalid user id 77 | * Invalid client id 78 | * User is not associated with client 79 | 80 | 81 | ### Version History 82 | 83 | | Version | Changelog | 84 | | ------- | --------- | 85 | | 8.0.0 | Initial Version | 86 | -------------------------------------------------------------------------------- /api-reference/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | title = "API Reference" 5 | weight = 0 6 | 7 | +++ 8 | 9 | ## Introduction 10 | 11 | The WHMCS API provides an interface to allow you to access and perform actions in WHMCS both from external applications and scripts as well as internal modules and addons. 12 | 13 | Choose a category from the left to browse the available API commands. 14 | 15 | [Learn more about the API](/api/) 16 | -------------------------------------------------------------------------------- /api-reference/logactivity.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "LogActivity" 3 | toc = true 4 | +++ 5 | 6 | Creates an activity log entry. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "LogActivity" | Required | 13 | | clientid | int | The ID of a client the log entry relates to. | Optional | 14 | | description | string | | Required | 15 | 16 | ### Response Parameters 17 | 18 | | Parameter | Type | Description | 19 | | --------- | ---- | ----------- | 20 | | result | string | The result of the operation: success or error | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'LogActivity', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'description' => 'Activity log entry text goes here', 37 | 'responsetype' => 'json', 38 | ) 39 | ) 40 | ); 41 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 42 | $response = curl_exec($ch); 43 | curl_close($ch); 44 | ``` 45 | 46 | 47 | ### Example Request (Local API) 48 | 49 | ``` 50 | $command = 'LogActivity'; 51 | $postData = array( 52 | 'description' => 'Activity log entry text goes here', 53 | ); 54 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 55 | 56 | $results = localAPI($command, $postData, $adminUsername); 57 | print_r($results); 58 | ``` 59 | 60 | 61 | ### Example Response JSON 62 | 63 | ``` 64 | { 65 | "result": "success" 66 | } 67 | ``` 68 | 69 | 70 | ### Version History 71 | 72 | | Version | Changelog | 73 | | ------- | --------- | 74 | | 1.0 | Initial Version | 75 | | 8.0 | Renamed `userid` parameter to `clientid`. | 76 | -------------------------------------------------------------------------------- /api-reference/modulechangepackage.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "ModuleChangePackage" 3 | toc = true 4 | +++ 5 | 6 | Runs a change package action for a given service. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "ModuleChangePackage" | Required | 13 | | serviceid | int | The service ID to run the action for | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'ModuleChangePackage', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'serviceid' => '1', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'ModuleChangePackage'; 50 | $postData = array( 51 | 'serviceid' => '1', 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success" 65 | } 66 | ``` 67 | 68 | 69 | ### Error Responses 70 | 71 | Possible error condition responses include: 72 | 73 | * Service ID is required 74 | * Service ID not found 75 | * Service not assigned to a module 76 | * Server response message 77 | 78 | 79 | ### Version History 80 | 81 | | Version | Changelog | 82 | | ------- | --------- | 83 | | 1.0 | Initial Version | 84 | | 7.7 | Renamed `accountid` parameter to `serviceid`. Backwards compatibility preserved for `accountid`. | 85 | -------------------------------------------------------------------------------- /api-reference/modulechangepw.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "ModuleChangePw" 3 | toc = true 4 | +++ 5 | 6 | Runs a change password action for a given service. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "ModuleChangePw" | Required | 13 | | serviceid | int | The service ID to run the action for | Required | 14 | | servicepassword | string | A new password to assign to the service | Optional | 15 | 16 | ### Response Parameters 17 | 18 | | Parameter | Type | Description | 19 | | --------- | ---- | ----------- | 20 | | result | string | The result of the operation: success or error | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'ModuleChangePw', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'serviceid' => '1', 37 | 'responsetype' => 'json', 38 | ) 39 | ) 40 | ); 41 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 42 | $response = curl_exec($ch); 43 | curl_close($ch); 44 | ``` 45 | 46 | 47 | ### Example Request (Local API) 48 | 49 | ``` 50 | $command = 'ModuleChangePw'; 51 | $postData = array( 52 | 'serviceid' => '1', 53 | ); 54 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 55 | 56 | $results = localAPI($command, $postData, $adminUsername); 57 | print_r($results); 58 | ``` 59 | 60 | 61 | ### Example Response JSON 62 | 63 | ``` 64 | { 65 | "result": "success" 66 | } 67 | ``` 68 | 69 | 70 | ### Error Responses 71 | 72 | Possible error condition responses include: 73 | 74 | * Service ID is required 75 | * Service ID not found 76 | * Service not assigned to a module 77 | * Server response message 78 | 79 | 80 | ### Version History 81 | 82 | | Version | Changelog | 83 | | ------- | --------- | 84 | | 1.0 | Initial Version | 85 | | 7.7 | Renamed `accountid` parameter to `serviceid`. Backwards compatibility preserved for `accountid`. | 86 | -------------------------------------------------------------------------------- /api-reference/modulecreate.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "ModuleCreate" 3 | toc = true 4 | +++ 5 | 6 | Runs the module create action for a given service. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "ModuleCreate" | Required | 13 | | serviceid | int | The service ID to run the action for | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'ModuleCreate', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'serviceid' => '1', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'ModuleCreate'; 50 | $postData = array( 51 | 'serviceid' => '1', 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success" 65 | } 66 | ``` 67 | 68 | 69 | ### Error Responses 70 | 71 | Possible error condition responses include: 72 | 73 | * Service ID is required 74 | * Service ID not found 75 | * Service not assigned to a module 76 | * Server response message 77 | 78 | 79 | ### Version History 80 | 81 | | Version | Changelog | 82 | | ------- | --------- | 83 | | 1.0 | Initial Version | 84 | | 7.7 | Renamed `accountid` parameter to `serviceid`. Backwards compatibility preserved for `accountid`. | 85 | -------------------------------------------------------------------------------- /api-reference/modulecustom.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "ModuleCustom" 3 | toc = true 4 | +++ 5 | 6 | Runs a custom module action for a given service. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "ModuleCustom" | Required | 13 | | serviceid | int | The service ID to run the action for | Required | 14 | | func_name | string | The name of the custom function to run | Required | 15 | 16 | ### Response Parameters 17 | 18 | | Parameter | Type | Description | 19 | | --------- | ---- | ----------- | 20 | | result | string | The result of the operation: success or error | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'ModuleCustom', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'serviceid' => '1', 37 | 'func_name' => 'reboot', 38 | 'responsetype' => 'json', 39 | ) 40 | ) 41 | ); 42 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 43 | $response = curl_exec($ch); 44 | curl_close($ch); 45 | ``` 46 | 47 | 48 | ### Example Request (Local API) 49 | 50 | ``` 51 | $command = 'ModuleCustom'; 52 | $postData = array( 53 | 'serviceid' => '1', 54 | 'func_name' => 'reboot', 55 | ); 56 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 57 | 58 | $results = localAPI($command, $postData, $adminUsername); 59 | print_r($results); 60 | ``` 61 | 62 | 63 | ### Example Response JSON 64 | 65 | ``` 66 | { 67 | "result": "success" 68 | } 69 | ``` 70 | 71 | 72 | ### Error Responses 73 | 74 | Possible error condition responses include: 75 | 76 | * Service ID is required 77 | * Service ID not found 78 | * Service not assigned to a module 79 | * Server response message 80 | 81 | 82 | ### Version History 83 | 84 | | Version | Changelog | 85 | | ------- | --------- | 86 | | 1.0 | Initial Version | 87 | | 7.7 | Renamed `accountid` parameter to `serviceid`. Backwards compatibility preserved for `accountid`. | 88 | -------------------------------------------------------------------------------- /api-reference/moduleterminate.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "ModuleTerminate" 3 | toc = true 4 | +++ 5 | 6 | Runs a terminate action for a given service. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "ModuleTerminate" | Required | 13 | | serviceid | int | The service ID to run the action for | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'ModuleTerminate', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'serviceid' => '1', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'ModuleTerminate'; 50 | $postData = array( 51 | 'serviceid' => '1', 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success" 65 | } 66 | ``` 67 | 68 | 69 | ### Error Responses 70 | 71 | Possible error condition responses include: 72 | 73 | * Service ID is required 74 | * Service ID not found 75 | * Service not assigned to a module 76 | * Server response message 77 | 78 | 79 | ### Version History 80 | 81 | | Version | Changelog | 82 | | ------- | --------- | 83 | | 1.0 | Initial Version | 84 | | 7.7 | Renamed `accountid` parameter to `serviceid`. Backwards compatibility preserved for `accountid`. | 85 | -------------------------------------------------------------------------------- /api-reference/moduleunsuspend.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "ModuleUnsuspend" 3 | toc = true 4 | +++ 5 | 6 | Runs an unsuspend action for a given service. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "ModuleUnsuspend" | Required | 13 | | serviceid | int | The service ID to run the action for | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'ModuleUnsuspend', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'serviceid' => '1', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'ModuleUnsuspend'; 50 | $postData = array( 51 | 'serviceid' => '1', 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success" 65 | } 66 | ``` 67 | 68 | 69 | ### Error Responses 70 | 71 | Possible error condition responses include: 72 | 73 | * Service ID is required 74 | * Service ID not found 75 | * Service not assigned to a module 76 | * Server response message 77 | 78 | 79 | ### Version History 80 | 81 | | Version | Changelog | 82 | | ------- | --------- | 83 | | 1.0 | Initial Version | 84 | | 7.7 | Renamed `accountid` parameter to `serviceid`. Backwards compatibility preserved for `accountid`. | 85 | -------------------------------------------------------------------------------- /api-reference/pendingorder.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "PendingOrder" 3 | toc = true 4 | +++ 5 | 6 | Sets an order, and all associated order items to Pending status 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "PendingOrder" | Required | 13 | | orderid | int | The order id to be accepted | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'PendingOrder', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'orderid' => '1', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'PendingOrder'; 50 | $postData = array( 51 | 'orderid' => '1', 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success" 65 | } 66 | ``` 67 | 68 | 69 | ### Error Responses 70 | 71 | Possible error condition responses include: 72 | 73 | * Order ID Not Found 74 | 75 | 76 | ### Version History 77 | 78 | | Version | Changelog | 79 | | ------- | --------- | 80 | | 1.0 | Initial Version | 81 | -------------------------------------------------------------------------------- /api-reference/resetpassword.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "ResetPassword" 3 | toc = true 4 | +++ 5 | 6 | Starts the password reset process for a user. 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "ResetPassword" | Required | 13 | | id | int | The id of the user to reset. The id can only belong to a user. | Optional | 14 | | email | string | The email address of the user update. Either $id or $email is required | Optional | 15 | 16 | ### Response Parameters 17 | 18 | | Parameter | Type | Description | 19 | | --------- | ---- | ----------- | 20 | | result | string | The result of the operation: success or error | 21 | 22 | 23 | ### Example Request (CURL) 24 | 25 | ``` 26 | $ch = curl_init(); 27 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 28 | curl_setopt($ch, CURLOPT_POST, 1); 29 | curl_setopt($ch, CURLOPT_POSTFIELDS, 30 | http_build_query( 31 | array( 32 | 'action' => 'ResetPassword', 33 | // See https://developers.whmcs.com/api/authentication 34 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 35 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 36 | 'email' => 'john.doe@example.com', 37 | 'responsetype' => 'json', 38 | ) 39 | ) 40 | ); 41 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 42 | $response = curl_exec($ch); 43 | curl_close($ch); 44 | ``` 45 | 46 | 47 | ### Example Request (Local API) 48 | 49 | ``` 50 | $command = 'ResetPassword'; 51 | $postData = array( 52 | 'email' => 'john.doe@example.com', 53 | ); 54 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 55 | 56 | $results = localAPI($command, $postData, $adminUsername); 57 | print_r($results); 58 | ``` 59 | 60 | 61 | ### Example Response JSON 62 | 63 | ``` 64 | { 65 | "result": "success" 66 | } 67 | ``` 68 | 69 | 70 | ### Error Responses 71 | 72 | Possible error condition responses include: 73 | 74 | * Please provide a valid email address 75 | * User Not Found 76 | * Please enter the email address or provide the id 77 | 78 | 79 | ### Version History 80 | 81 | | Version | Changelog | 82 | | ------- | --------- | 83 | | 1.0 | Initial Version | 84 | | 8.0 | Migrated Reset Password to User | 85 | -------------------------------------------------------------------------------- /api-reference/sendquote.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "SendQuote" 3 | toc = true 4 | +++ 5 | 6 | Send a quote to the associated client 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "SendQuote" | Required | 13 | | quoteid | int | The id of the quote to send | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'SendQuote', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'quoteid' => '1', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'SendQuote'; 50 | $postData = array( 51 | 'quoteid' => '1', 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success" 65 | } 66 | ``` 67 | 68 | 69 | ### Error Responses 70 | 71 | Possible error condition responses include: 72 | 73 | * Quote ID Not Found 74 | 75 | 76 | ### Version History 77 | 78 | | Version | Changelog | 79 | | ------- | --------- | 80 | | 1.0 | Initial Version | 81 | -------------------------------------------------------------------------------- /api-reference/updateadminnotes.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "UpdateAdminNotes" 3 | toc = true 4 | +++ 5 | 6 | Update the admin notes 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "UpdateAdminNotes" | Required | 13 | | notes | string | The new value for the admin notes | Required | 14 | 15 | ### Response Parameters 16 | 17 | | Parameter | Type | Description | 18 | | --------- | ---- | ----------- | 19 | | result | string | The result of the operation: success or error | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'UpdateAdminNotes', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'notes' => 'This is an admin note', 36 | 'responsetype' => 'json', 37 | ) 38 | ) 39 | ); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 41 | $response = curl_exec($ch); 42 | curl_close($ch); 43 | ``` 44 | 45 | 46 | ### Example Request (Local API) 47 | 48 | ``` 49 | $command = 'UpdateAdminNotes'; 50 | $postData = array( 51 | 'notes' => 'This is an admin note', 52 | ); 53 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 54 | 55 | $results = localAPI($command, $postData, $adminUsername); 56 | print_r($results); 57 | ``` 58 | 59 | 60 | ### Example Response JSON 61 | 62 | ``` 63 | { 64 | "result": "success" 65 | } 66 | ``` 67 | 68 | 69 | ### Version History 70 | 71 | | Version | Changelog | 72 | | ------- | --------- | 73 | | 1.0 | Initial Version | 74 | -------------------------------------------------------------------------------- /api-reference/whmcsdetails.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "WhmcsDetails" 3 | toc = true 4 | +++ 5 | 6 | Obtain details pertaining to the current WHMCS installation 7 | 8 | ### Request Parameters 9 | 10 | | Parameter | Type | Description | Required | 11 | | --------- | ---- | ----------- | -------- | 12 | | action | string | "WhmcsDetails" | Required | 13 | 14 | ### Response Parameters 15 | 16 | | Parameter | Type | Description | 17 | | --------- | ---- | ----------- | 18 | | result | string | The result of the operation: success or error | 19 | | whmcs | array | The version details of the current WHMCS installation | 20 | 21 | 22 | ### Example Request (CURL) 23 | 24 | ``` 25 | $ch = curl_init(); 26 | curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php'); 27 | curl_setopt($ch, CURLOPT_POST, 1); 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, 29 | http_build_query( 30 | array( 31 | 'action' => 'WhmcsDetails', 32 | // See https://developers.whmcs.com/api/authentication 33 | 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 34 | 'password' => 'SECRET_OR_HASHED_PASSWORD', 35 | 'responsetype' => 'json', 36 | ) 37 | ) 38 | ); 39 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 40 | $response = curl_exec($ch); 41 | curl_close($ch); 42 | ``` 43 | 44 | 45 | ### Example Request (Local API) 46 | 47 | ``` 48 | $command = 'WhmcsDetails'; 49 | $postData = array( 50 | ); 51 | $adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later 52 | 53 | $results = localAPI($command, $postData, $adminUsername); 54 | print_r($results); 55 | ``` 56 | 57 | 58 | ### Example Response JSON 59 | 60 | ``` 61 | { 62 | "result": "success", 63 | "whmcs": { 64 | "version": "8.0.0", 65 | "canonicalversion": "8.0.0-release.1" 66 | } 67 | } 68 | ``` 69 | 70 | 71 | ### Version History 72 | 73 | | Version | Changelog | 74 | | ------- | --------- | 75 | | 8.0.0 | Initial Version | 76 | -------------------------------------------------------------------------------- /api/access-control.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/api/response-types/" 3 | prev = "/api/authentication/" 4 | title = "Access Control" 5 | toc = true 6 | weight = 30 7 | 8 | +++ 9 | 10 | Access to the API by default is restricted by IP. 11 | 12 | For situations where IP access control is not feasible, an Access Key can also be configured. 13 | 14 | ## Managing Allowed IPs 15 | 16 | To configure the Allowed IPs, login to the WHMCS admin area and navigate to Setup > General Settings > Security. 17 | 18 | There you can add and remove IPs, along with a note referencing. 19 | 20 | ## Configuring an Access Key 21 | 22 | Alternatively an access key can be configured to allow IP restrictions to be bypassed. 23 | 24 | It works by defining a secret key/passphrase in the WHMCS configuration.php file which is then passed into all API calls. To configure it, add a line as follows to your `configuration.php` file in the root WHMCS directory. 25 | 26 | ``` 27 | $api_access_key = 'secret_key_passphrase_goes_here'; 28 | ``` 29 | 30 | An API Access Key can contain letters, numbers, and the following special characters only: 31 | 32 | ``` 33 | ! @ # $ % . ( ) * [ ] - _ 34 | ``` 35 | 36 | Following the introduction of an API Access Key, you can then include it in your API requests as follows: 37 | 38 | ``` 39 | ?action=xxxx&username=xxx&password=xxx&accesskey=secret_key_passphrase_goes_here 40 | ``` 41 | -------------------------------------------------------------------------------- /api/authentication.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/api/internal-api" 3 | prev = "/api/getting-started" 4 | title = "Authentication" 5 | toc = true 6 | weight = 20 7 | 8 | +++ 9 | 10 | Use of the API requires API Authentication Credentials. As well, the associated admin user must have the `API Access` permission granted to their admin role group. 11 | 12 | API Authentication Credentials can be generated for an admin user within the Admin area as described in the [WHMCS Documentation](http://docs.whmcs.com/API_Authentication_Credentials). 13 | 14 | Authentication is required for each API request. 15 | 16 | ## Authenticating with API Credentials 17 | 18 | API requests will be authenticated based on the request parameters `identifier` and `secret` as provisioned when [Creating Admin API Authentication Credentials](http://docs.whmcs.com/API_Authentication_Credentials#Creating_Admin_API_Authentication_Credentials) within the WHMCS Admin Area. 19 | 20 | ``` 21 | $api_identifier = 'D4j1dKYE3g40VROOPCGyJ9zRwP0ADJIv'; 22 | $api_secret = 'F1CKGXRIpylMfsrig3mwwdSdYUdLiFlo'; 23 | 24 | $postfields = array( 25 | 'identifier' => $api_identifier, 26 | 'secret' => $api_secret, 27 | 'action' => $api_call, 28 | 'responsetype' => $response_type, 29 | ); 30 | ``` 31 | 32 | For forwards compatibility with existing integrations, the `identifier` and `secret` may also be passed in the `username` and `password` fields respectively. A valid identifier and secret combination passed in this way will also result in successful authentication. 33 | 34 | ## Authenticating with Login Credentials 35 | 36 | Prior to WHMCS version 7.2, authentication was validated based on admin login credentials, and not API Authentication Credentials. 37 | This method of authentication is still supported for backwards compatibility but may be deprecated in a future version of WHMCS. 38 | 39 | To authenticate with the admin login credentials, pass the admin `username` and the MD5 hashed value of the respective admin's `password`. 40 | 41 | ``` 42 | $username = "your_admin_login_username"; 43 | $password = "your_admin_login_password"; 44 | 45 | $postfields = array( 46 | 'username' => $username, 47 | 'password' => md5($password), 48 | 'action' => $api_call, 49 | 'responsetype' => $response_type, 50 | ); 51 | ``` 52 | -------------------------------------------------------------------------------- /api/getting-started.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/api/authentication/" 3 | prev = "/api" 4 | title = "Getting Started" 5 | toc = true 6 | weight = 10 7 | 8 | +++ 9 | 10 | Two methods are provided for accessing the API. 11 | 12 | ## External API 13 | 14 | The External API should be used when the system making the call is hosted remotely from the WHMCS installation. 15 | 16 | This API accepts `POST` requests to the API endpoint located at: 17 | 18 | > https://www.yourdomain.com/path/to/whmcs/includes/api.php 19 | 20 | ## Internal API 21 | 22 | The Internal API should be used when making API calls from within the WHMCS system. 23 | 24 | For instance from modules, hooks, or other custom code local to the WHMCS installation. 25 | -------------------------------------------------------------------------------- /api/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | next = "/api/getting-started" 5 | title = "API" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ## Introduction 11 | 12 | The WHMCS API allows you to perform operations and actions within WHMCS from external third party and custom code. 13 | 14 | * **[Getting Started](/api/getting-started/)**
Learn about how to get started with the API 15 | * **[Authentication](/api/authentication/)**
Learn how authentication works for the WHMCS API 16 | * **[Access Control](/api/access-control/)**
Learn how IP and Access Key control works for the WHMCS API 17 | * **[Response Types](/api/response-types/)**
Learn about the different response types 18 | * **[Sample Code](/api/sample-code/)**
See sample code for remotely connecting to the WHMCS API 19 | * **[Internal API](/api/internal-api/)**
See sample code for using the Local WHMCS API 20 | * **[API Index](/api/api-index/)**
A complete listing of all available API commands 21 | * **[API Reference](/api-reference/)**
Visit the API Reference Manual 22 | -------------------------------------------------------------------------------- /api/internal-api.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/api/sample-code/" 3 | next = "/api/api-index/" 4 | title = "Internal API" 5 | toc = true 6 | weight = 60 7 | 8 | +++ 9 | 10 | The Internal API should be used when making API calls from within the WHMCS system. 11 | 12 | Common uses for this include from modules, hooks, or other custom code local to the WHMCS installation. 13 | 14 | The import of `init.php` is not required when you’re already in a WHMCS runtime (like in a hook) where `init.php` has already been imported. 15 | 16 | ## Usage Example 17 | 18 | ``` 19 | 26 | * @copyright Copyright (c) WHMCS Limited 2005-2016 27 | * @license http://www.whmcs.com/license/ WHMCS Eula 28 | * @version $Id$ 29 | * @link http://www.whmcs.com/ 30 | */ 31 | 32 | require_once 'init.php'; 33 | 34 | // Define parameters 35 | $command = 'SendEmail'; 36 | $values = array( 37 | 'messagename' => 'Test Template', 38 | 'id' => '1', 39 | ); 40 | $adminuser = 'AdminUsername'; 41 | 42 | // Call the localAPI function 43 | $results = localAPI($command, $values, $adminuser); 44 | if ($results['result'] == 'success') { 45 | echo 'Message sent successfully!'; 46 | } else { 47 | echo "An Error Occurred: " . $results['message']; 48 | } 49 | 50 | ``` 51 | -------------------------------------------------------------------------------- /api/response-types.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/api/sample-code/" 3 | prev = "/api/access-control/" 4 | title = "Response Types" 5 | toc = true 6 | weight = 40 7 | 8 | +++ 9 | 10 | The API supports 3 response types: 11 | 12 | * JSON **(Recommended)** 13 | * XML 14 | * NVP (Deprecated) 15 | 16 | You can define the response type you wish to receive by including `responsetype=xxxx` in your request parameters. 17 | -------------------------------------------------------------------------------- /api/sample-code.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/api/internal-api/" 3 | prev = "/api/response-types/" 4 | title = "Sample Code" 5 | toc = true 6 | weight = 50 7 | 8 | +++ 9 | 10 | The following demonstrates how to connect to the WHMCS API from a PHP script using CURL. 11 | 12 | ``` 13 | 19 | * @copyright Copyright (c) WHMCS Limited 2005-2021 20 | * @license http://www.whmcs.com/eula/ WHMCS Eula 21 | * @link http://www.whmcs.com/ 22 | */ 23 | 24 | // API Connection Details 25 | $whmcsUrl = "https://www.yourdomain.com/path/to/whmcs/"; 26 | 27 | // For WHMCS 7.2 and later, we recommend using an API Authentication Credential pair. 28 | // Learn more at http://docs.whmcs.com/API_Authentication_Credentials 29 | // Prior to WHMCS 7.2, an admin username and md5 hash of the admin password may be used 30 | // with the 'username' and 'password' keys instead of 'identifier' and 'secret'. 31 | $api_identifier = "your_api_credential_identifier"; 32 | $api_secret = "your_api_credential_secret"; 33 | 34 | // Set post values 35 | $postfields = array( 36 | 'identifier' => $api_identifier, 37 | 'secret' => $api_secret, 38 | 'action' => 'GetClients', 39 | 'responsetype' => 'json', 40 | ); 41 | 42 | // Call the API 43 | $ch = curl_init(); 44 | curl_setopt($ch, CURLOPT_URL, $whmcsUrl . 'includes/api.php'); 45 | curl_setopt($ch, CURLOPT_POST, 1); 46 | curl_setopt($ch, CURLOPT_TIMEOUT, 30); 47 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 48 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); 49 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 50 | curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields)); 51 | $response = curl_exec($ch); 52 | if (curl_error($ch)) { 53 | die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch)); 54 | } 55 | curl_close($ch); 56 | 57 | // Decode response 58 | $jsonData = json_decode($response, true); 59 | 60 | // Dump array structure for inspection 61 | var_dump($jsonData); 62 | ``` 63 | -------------------------------------------------------------------------------- /classes-reference/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "iii. " 4 | next = "/next/path" 5 | prev = "/prev/path" 6 | title = "Classes Reference" 7 | weight = 0 8 | 9 | +++ 10 | 11 | ### Classes 12 | 13 | # Documentation 14 | 15 | We make available a number of our internal model classes to make developing modules and hooks and working with the WHMCS database easier. 16 | 17 |

18 | {{% button href="http://docs.whmcs.com/classes/index.html" target="_blank" %}} Launch Class Documentation{{% /button %}} 19 |

20 | -------------------------------------------------------------------------------- /domain-registrars/client-area-output.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/domain-registrars/module-logging/" 3 | title = "Client Area Output" 4 | weight = 100 5 | +++ 6 | 7 | Using this function, it is possible to output custom HTML in the Client Area when a client is managing a domain name. 8 | 9 | Using the `_ClientArea` function, you can return output that will be shown in the Domain Overview when viewing a domain in the Client Area. 10 | 11 | All the parameters available in other registrar module functions are available to you within this function. 12 | Visit the [Module Parameters](https://developers.whmcs.com/domain-registrars/module-parameters/) page for information on the variables available in `$params`. 13 | 14 | The function should return the HTML to be rendered on the page. 15 | 16 | Note: We recommend avoiding making remote API calls within this function as doing so will result in increased overheads for page 17 | load and potentially slower page load times. 18 | 19 | ``` 20 | /** 21 | * Client Area Output. 22 | * 23 | * This function renders output to the domain details interface within 24 | * the client area. The return should be the HTML to be output. 25 | * 26 | * @param array $params common module parameters 27 | * 28 | * @see https://developers.whmcs.com/domain-registrars/module-parameters/ 29 | * 30 | * @return string HTML Output 31 | */ 32 | function registrarmodule_ClientArea($params) 33 | { 34 | $output = << 36 | Your custom HTML output goes here... 37 | 38 | HTML; 39 | return $output; 40 | } 41 | ``` -------------------------------------------------------------------------------- /domain-registrars/getting-started.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/domain-registrars/config-options/" 3 | prev = "/domain-registrars/" 4 | title = "Getting Started" 5 | weight = 10 6 | 7 | +++ 8 | 9 | ## GitHub 10 | 11 | We make available a sample provisioning module on GitHub. We recommend using this as a starting point for a custom module. 12 | 13 | > https://github.com/WHMCS/sample-registrar-module 14 | 15 | ## Choosing a Name 16 | 17 | Registrar Modules are located in the `/modules/registrars/` directory. 18 | 19 | {{% notice info %}} 20 | Module names should be a single word, consisting of only lowercase letters and numbers. The name must start with a letter, and must be unique. 21 | {{% /notice %}} 22 | -------------------------------------------------------------------------------- /domain-registrars/hooks.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/domain-registrars/module-logging/" 3 | prev = "/domain-registrars/extending-further/" 4 | title = "Hooks" 5 | weight = 130 6 | 7 | +++ 8 | 9 | Registrar modules can also define hook functions. 10 | 11 | {{% notice info %}} 12 | Hooks allow you to integrate with events and actions that occur inside WHMCS. 13 | {{% /notice %}} 14 | 15 | Hooks for your registrar module should be defined in a file named `hooks.php` within your registrar module directory. These hooks will then be auto-detected and loaded throughout WHMCS. 16 | 17 | The hook functions within that file should be defined in exactly the same way as normal. 18 | 19 | Please refer to Hook Documentation for more info on creating and working with hooks in WHMCS. 20 | 21 | -------------------------------------------------------------------------------- /domain-registrars/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | next = "/domain-registrars/getting-started/" 5 | title = "Domain Registrars" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ## Introduction 11 | 12 | **Registrar Modules** allow for the registration and management of domains within WHMCS. 13 | 14 | Registrar Modules are also referred to as **Domain Modules**. 15 | 16 | The core function of a registrar module is registering, transferring and renewing of domains. These are triggered when payments are made within WHMCS for domain purchases or renewals. 17 | 18 | Other functionality a registrar module can provide includes the following: 19 | 20 | * checking availability of domains 21 | * providing domain name suggestions 22 | * viewing and updating of nameservers 23 | * viewing and updating of WHOIS information 24 | * viewing and management of DNS Host Records 25 | * viewing and management of Email Forwarding services 26 | * fetching of the EPP Code / Domain Release 27 | * management of Registrar Lock status 28 | * registering, modification and deletion of Private Nameservers 29 | * enable/disable of ID Protection 30 | * domain expiry date and status synchronization 31 | * transfer status monitoring 32 | * deletion requests 33 | 34 | Unlimited custom additional functionality can also be implemented using custom methods. 35 | -------------------------------------------------------------------------------- /domain-registrars/metadata-params.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/domain-registrars/module-parameters/" 3 | prev = "/domain-registrars/domain-syncing/" 4 | title = "Metadata Parameters" 5 | toc = true 6 | weight = 45 7 | 8 | +++ 9 | 10 | [Registrar Modules][domain-registrars] support a number of metadata configuration parameters. 11 | 12 | They include: 13 | 14 | | Name | Type | Supported As Of | Default | Description | 15 | | ---- | ---- | --------------- | ------- | ----------- | 16 | | DisplayName | Text | 6.0 | Module Name | *An alternate display name that will be used instead of the filename if defined.* | 17 | | APIVersion | Text | 5.2 | 1.1 | *Defines the API version the module uses. Use `1.1` unless you have a need specific to use `1.0`.* | 18 | | NonLinearRegistrationPricing | Boolean | 8.1 | false | *Indicates that there is a difference between the registration amount and renewal amount when importing TLDs. If you set this to `true`, WHMCS will use a nonlinear equation to calculate the appropriate pricing.* | 19 | 20 | The following example illustrates how one might make a simple MetaData function. 21 | 22 | ## Example MetaData Function 23 | 24 | ``` 25 | function mymodule_MetaData() { 26 | return array( 27 | 'DisplayName' => 'myModule', 28 | 'APIVersion' => '1.1', 29 | 'NonLinearRegistrationPricing' => false, 30 | ); 31 | } 32 | ``` 33 | -------------------------------------------------------------------------------- /domain-registrars/module-functions.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/domain-registrars/domain-information/" 3 | prev = "/domain-registrars/module-parameters/" 4 | title = "Module Functions" 5 | weight = 60 6 | 7 | +++ 8 | 9 | Registrar module functions are expected to return data and information to WHMCS for rendering to the end user. 10 | 11 | The data should be returned as part of a structured array. The exact format varies depending upon the registrar module function being invoked, and the data it returns. For specific details of the expected and supported values, please refer to the sample registrar module. 12 | 13 | ## Error Handling 14 | 15 | Registrar module functions will assume success providing no error message is returned. 16 | 17 | In the event of an error or failure, a user friendly error message should be returned in the `error` variable. 18 | 19 | ``` 20 | return array( 21 | 'error' => 'Domain name not found', 22 | ); 23 | ``` 24 | User-friendly error messages are exposed to administrators within the Admin Area. User-friendly error messages are never exposed to clients within the Client Area to protect the potentially sensitive nature of the message being returned. -------------------------------------------------------------------------------- /domain-registrars/module-logging.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/domain-registrars/hooks/" 3 | next = "/domain-registrars/client-area-output/" 4 | title = "Module Logging" 5 | weight = 140 6 | 7 | +++ 8 | 9 | We recommend you make use of the built in module logging functionality for WHMCS modules. 10 | 11 | This makes debugging the external API calls your module makes follow the standardised pattern and makes it easier to debug. 12 | 13 | Please refer to the URL below for more details on how to do this. 14 | 15 | https://developers.whmcs.com/provisioning-modules/module-logging/ 16 | -------------------------------------------------------------------------------- /domain-registrars/premium-domains.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/domain-registrars/transfer-policy-management/" 3 | prev = "/domain-registrars/availability-checks/" 4 | title = "Premium Domains" 5 | weight = 90 6 | 7 | +++ 8 | 9 | In WHMCS 7.1 and later, registrar modules can include support for the selling of Premium Domains. 10 | 11 | Premium Domains cannot be detected with traditional WHOIS lookups, and therefore to use Premium Domains, it requires a registrar module to implement the [Availability Check](/domain-registrars/availability-checks/) functions. 12 | 13 | ## How It Works 14 | 15 | Premium Domain functionality must be enabled by admin users before it can be used. The status is passed as a boolean value to both the CheckAvailability and GetSuggestions registrar module functions under the parameter `premiumEnabled`. 16 | 17 | When enabled, domain availability checks must return if a domain is premium, and if it is, also return pricing information. 18 | 19 | The cost price of the registration will then be converted into the end users currency, and a markup as defined by the WHMCS admin user will be applied before displaying the price to the end user. 20 | 21 | The registration and renewal registrar module functions will be passed two additional parameters when Premium Domains are enabled: 22 | 23 | | Variable | Type | Description | 24 | | --------- | ----------- | ----------- | 25 | | premiumEnabled | bool | If Premium Domains are enabled for this WHMCS installation 26 | | premiumCost | float | The cost price for the action being performed (registration or renewal) 27 | 28 | {{% notice info %}} 29 | If the cost price passed to the Register or Renew functions by WHMCS does not match the cost price of the domain at the time the action is being performed, the process should be aborted and an appropriate error message should be returned for the admin user. 30 | {{% /notice %}} 31 | 32 | ### Code Sample 33 | 34 | Please refer to the example provided in the [Sample Registrar Module available via GitHub](https://github.com/WHMCS/sample-registrar-module) for an example implementation of the `CheckAvailability` and `Register` functions. Both include the appropriate parameters for Premium Domain handling. 35 | -------------------------------------------------------------------------------- /hooks-reference/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | title = "Hooks Reference" 5 | weight = 0 6 | 7 | +++ 8 | 9 | ## Introduction 10 | 11 | Hooks allow you to execute your own code when events occur inside WHMCS. 12 | 13 | Choose a category from the left to browse the available hook points. 14 | 15 | [Learn more about hooks](/hooks/) 16 | -------------------------------------------------------------------------------- /hooks-reference/user.md: -------------------------------------------------------------------------------- 1 | +++ 2 | title = "User" 3 | weight = 10 4 | 5 | +++ 6 | 7 | The following hooks are provided for User related events. 8 | 9 | ## UserAdd 10 | 11 | Executes as a user is being added to WHMCS. 12 | 13 | #### Parameters 14 | 15 | | Variable | Type | Notes | 16 | | -------- | ---- | ----- | 17 | | user_id | int | The id of the user that has been added | 18 | | firstname | string | | 19 | | lastname | string | | 20 | | email | string | | 21 | | password | string | | 22 | | language | string | | 23 | 24 | #### Response 25 | 26 | No response supported 27 | 28 | #### Example Code 29 | 30 | ``` 31 | " 4 | next = "/hooks/getting-started" 5 | title = "Hooks" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ## Introduction 11 | 12 | Hooks allow you to execute your own code when events occur inside WHMCS. 13 | 14 | * **[Getting Started](/hooks/getting-started/)**
Learn how to create a hook in WHMCS 15 | * **[Defining Priority](/hooks/priority/)**
Priorities allow you to define in which order hooks execute 16 | * **[Module Hooks](/hooks/module-hooks/)**
Learn how modules can take advantage of hooks 17 | * **[Sample Hook](/hooks/sample-hook/)**
View sample code for creating a hook 18 | * **[Hook Index](/hooks/hook-index/)**
A complete listing of all available hook points 19 | * **[Hook Reference](/hooks-reference/)**
Visit the Hook Reference Manual 20 | -------------------------------------------------------------------------------- /hooks/module-hooks.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/hooks/sample-hook" 3 | prev = "/hooks/priority" 4 | title = "Module Hooks" 5 | toc = true 6 | weight = 15 7 | 8 | +++ 9 | 10 | Module hooks follow all the same principles as regular hooks. 11 | 12 | ## Defining Hooks within a Module 13 | 14 | To provide hooks as part of a module, create a file named `hooks.php` in the root of your module directory. 15 | 16 | This hooks file will be detected and loaded by WHMCS on every page load. 17 | 18 | {{% notice note %}} 19 | Please note that hook files are detected at the time a provisioning, registrar, or addon module is activated. If a hook file is added after the module has already been activated, some additional steps may need to be performed for WHMCS to recognize it. For provisioning modules, this can be accomplished by accessing the Module Settings tab of an applicable product under **Setup** > **Products/Services** > **Products/Services** and clicking **Save Changes**. For a registrar module, re-saving the settings for it under **Setup** > **Products/Services** > **Domain Registrars** would be sufficient. Finally, for addon modules, re-saving the settings under Setup > Addon Modules will address this. 20 | {{% /notice %}} -------------------------------------------------------------------------------- /hooks/priority.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/hooks/module-hooks" 3 | prev = "/hooks/getting-started" 4 | title = "Defining Priority" 5 | toc = true 6 | weight = 10 7 | 8 | +++ 9 | 10 | Every hook function must be registered with a priority. 11 | 12 | The priority defines the order in which hooks should run when multiple hooks are registered for the same hook point. 13 | 14 | {{% notice info %}} 15 | The priority can be any valid integer value. 16 | {{% /notice %}} 17 | -------------------------------------------------------------------------------- /hooks/sample-hook.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/hooks/hook-index" 3 | prev = "/hooks/module-hooks" 4 | title = "Sample Hook" 5 | toc = true 6 | weight = 20 7 | 8 | +++ 9 | 10 | `/includes/hooks/samplehook.php` 11 | 12 | The hook below will execute whenever the `ClientAdd` event occurs: 13 | 14 | ``` 15 | " 4 | next = "/intro/overview" 5 | title = "Introduction" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ### Developer Documentation 11 | 12 | # Introduction 13 | 14 | Welcome to the WHMCS Developer Documentation. 15 | -------------------------------------------------------------------------------- /intro/overview.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/intro" 3 | title = "Overview" 4 | toc = true 5 | weight = 5 6 | 7 | +++ 8 | 9 | WHMCS is a web based recurring billing and automation platform for web hosting providers. 10 | 11 | ## Purpose 12 | 13 | The purpose of this documentation is to provide developers with the information needed to work with the WHMCS platform to integrate and extend functionality. 14 | 15 | ## Intended Audience 16 | 17 | The intended audience for this documentation is users and developers. 18 | 19 | You are expected to be familiar with PHP and associated technologies/standards. 20 | -------------------------------------------------------------------------------- /languages/adding-a-language.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/languages/locales/" 3 | prev = "/languages/" 4 | title = "Adding a Language" 5 | weight = 10 6 | 7 | +++ 8 | 9 | The language system in WHMCS allows you to create your own additional language translations. 10 | 11 | We recommend starting by duplicating one of the existing language files. 12 | 13 | {{% notice info %}} 14 | Language file names should be a single word, consisting of only lowercase letters and numbers. The file must end with the extension **.php**. 15 | {{% /notice %}} 16 | 17 | 1. Begin by opening an existing language file, for example `lang/english.php` 18 | 2. Save this file with a new name. The name you choose will be shown in the language selection dropdown menu inside WHMCS. 19 | 3. Translate the words and phrases contained within it into your new language. Be careful not to change the language key names, only the words and phrases contained within the double quotes on each line. 20 | 21 | {{% notice tip %}} 22 | Be careful not to delete any of the quotation marks (") around the text strings or the semi-colons on the ends of each line (;). Also should you want to use a quote character (") within your translated text, you must escape it - for example: \" The language files are written in PHP syntax so valid PHP code must be maintained. 23 | {{% /notice %}} 24 | 25 | 4. Upload your new language file to your WHMCS installations `/lang/` directory. 26 | 5. The language file will now be available for use. 27 | 28 | Test it by visiting your WHMCS installation client area and selecting the language file from the dropdown. If you encounter any errors, this suggests your changes to the language file have introduced a syntax error. Please double check your modifications and try again. 29 | -------------------------------------------------------------------------------- /languages/contributing.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/languages/translating/" 3 | title = "Contributing" 4 | weight = 60 5 | 6 | +++ 7 | 8 | The language translations provided with WHMCS are thanks to our community of users who dedicate their time to translating and contributing their translations for the benefit of others. 9 | 10 | We welcome suggestions for change and improvements to translations to be submitted to us via Support Ticket. 11 | 12 | For all accepted translations, we offer a WHMCS account credit. 13 | -------------------------------------------------------------------------------- /languages/encoding.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/languages/overrides/" 3 | prev = "/languages/locales/" 4 | title = "Encoding" 5 | weight = 30 6 | 7 | +++ 8 | 9 | By default, language files in WHMCS use UTF-8 encoding without a Byte Order Marker character. 10 | 11 | When modifying language files it is important to maintain the same encoding. 12 | 13 | If you have chosen to change the system charset to something other than UTF-8 (for example iso-8859-1) then the language files will need to be re-saved with ANSI encoding (also without a Byte Order Marker). Most text editors have this option (including Notepad). 14 | -------------------------------------------------------------------------------- /languages/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | next = "/languages/adding-a-language/" 5 | title = "Languages" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ## Introduction 11 | 12 | WHMCS is fully multi-lingual and supports over 25 different languages out of the box. 13 | 14 | Words and phrases are defined in language files stored in the `lang` directories within both the admin and client areas. 15 | 16 | If you wish to customise any of the language strings, we recommend using [Overrides](/languages/overrides/). 17 | 18 | {{% notice tip %}} 19 | If you spot an inaccuracy or inconsistency in a translation, please contact us and let us know. We rely on the dedication and generosity of our users for contributing translations. 20 | {{% /notice %}} 21 | -------------------------------------------------------------------------------- /languages/locales.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/languages/encoding/" 3 | prev = "/languages/adding-a-language/" 4 | title = "Locales" 5 | weight = 20 6 | 7 | +++ 8 | 9 | Locales define the language and region for a language file. 10 | 11 | Each language file in WHMCS requires a locale to be defined in the following format: 12 | 13 | ``` 14 | $_LANG['locale'] = "en_GB"; 15 | ``` 16 | 17 | The above defines that the language is English (en), and the region is Great Britain (GB). 18 | 19 | The locale information is used by WHMCS to localise and display the language name localised to the native language within the WHMCS client area. 20 | 21 | Failure to provide a valid locale will prevent the language file from showing up as available for use within WHMCS. 22 | -------------------------------------------------------------------------------- /languages/overrides.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/languages/translating/" 3 | prev = "/languages/encoding/" 4 | title = "Overrides" 5 | weight = 40 6 | 7 | +++ 8 | 9 | The language files are provided unencoded to allow you to view the language strings that WHMCS uses. 10 | 11 | However we do not recommend editing these files directly. Instead overrides should be used. 12 | 13 | Language file overrides allow you to customise language strings and phrases in a way that is safely preserved through the upgrade process. 14 | 15 | ## Using Overrides 16 | 17 | Steps for customising language strings via overrides are as follows: 18 | 19 | 1. Create a directory named `overrides` within the `/path/to/whmcs/lang/` directory. 20 | 2. Create or copy the language file you want to override. For example, to create an override for the English language you create `/path/to/whmcs/lang/overrides/english.php` 21 | 3. Open the newly created file in your preferred editor. 22 | 4. Start the file with a PHP tag `" 4 | title = "Mail Providers" 5 | next = "/mail-providers/getting-started" 6 | weight = 0 7 | 8 | +++ 9 | 10 | Mail Providers determine how WHMCS transmits email to admins and their customers. We added this feature in WHMCS 8.0. 11 | 12 | You can learn more about Mail Providers in WHMCS in our [Mail Providers](https://docs.whmcs.com/Mail_Providers) documentation. 13 | 14 | To get started, continue to the Getting Started page. 15 | -------------------------------------------------------------------------------- /mail-providers/provider-settings.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/mail-providers/send-notification" 3 | prev = "/mail-providers/getting-started" 4 | title = "Provider Settings" 5 | toc = true 6 | weight = 10 7 | 8 | +++ 9 | 10 | A Mail Provider can define required settings to activate the mail provider module. 11 | 12 | The field definitions you return from this method are used to build a form in the admin user interface that must be filled out in order to activate the mail provider module. 13 | 14 | For example, if the module connects to a remote messaging service, this might be a username and password or a required OAuth token to authenticate to that service. 15 | 16 | Supported field types are `text`, `password`, `yesno`, `dropdown`, `radio`, and `textarea`. 17 | 18 | Below is an example of two defined fields, with the names `api_username` and `api_password`. 19 | 20 | ``` 21 | /** 22 | * Provider settings. 23 | * 24 | * @return array 25 | */ 26 | public function settings() 27 | { 28 | return [ 29 | 'api_username' => [ 30 | 'FriendlyName' => 'API Username', 31 | 'Type' => 'text', 32 | 'Description' => 'The required username to authenticate with messaging service.', 33 | ], 34 | 'api_password' => [ 35 | 'FriendlyName' => 'API Password', 36 | 'Type' => 'password', 37 | 'Description' => 'The required password to authenticate with messaging service.', 38 | ], 39 | ]; 40 | } 41 | ``` 42 | 43 | ## Validating User-Supplied Setting Values 44 | 45 | On submission of mail provider settings, you can validate the user-provided values using the `testConnection` method. 46 | 47 | If validation fails, throw an exception to abort the save action and display an error message to the end user. The error message will be the message within the exception. 48 | 49 | ``` 50 | /** 51 | * Test connection. 52 | * 53 | * @param array $settings 54 | * 55 | * @return array 56 | */ 57 | public function testConnection($settings) 58 | { 59 | $api_username = $settings['api_username']; 60 | $api_password = $settings['api_password']; 61 | 62 | // Attempt to connect to API service to verify input credentials 63 | // and upon error, throw an exception. 64 | 65 | throw new \Exception('The system was unable to authenticate with the supplied API username and password.'); 66 | } 67 | ``` 68 | -------------------------------------------------------------------------------- /modules/code-samples.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/modules/style-guide/" 3 | prev = "/modules/getting-started/" 4 | title = "Code Samples" 5 | weight = 20 6 | 7 | +++ 8 | 9 | We make available sample code for each of our module types via [GitHub](https://github.com/whmcs). 10 | 11 | * Sample Gateway Module - https://github.com/WHMCS/sample-gateway-module 12 | * Sample Merchant Gateway - https://github.com/WHMCS/sample-merchant-gateway 13 | * Sample Provisioning Module - https://github.com/WHMCS/sample-provisioning-module 14 | * Sample Domain Registrar Module - https://github.com/WHMCS/sample-registrar-module 15 | * Sample Addon Module - https://github.com/WHMCS/sample-addon-module 16 | -------------------------------------------------------------------------------- /modules/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | next = "/modules/getting-started/" 5 | title = "Modules" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ## Introduction 11 | 12 | A module is a collection of functions that provide additional functionality to the WHMCS platform, most commonly used to integrate with third party services and APIs. 13 | 14 | #### Choose a module type to begin... 15 | 16 | 60 | -------------------------------------------------------------------------------- /modules/marketplace.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/modules/style-guide/" 3 | next = "/modules/module-class-autoloading/" 4 | title = "Marketplace" 5 | weight = 40 6 | 7 | +++ 8 | 9 |
10 | 11 | WHMCS Marketplace 12 | 13 |
14 | 15 | The WHMCS Marketplace allows users of WHMCS to connect with, find and discover add-ons and extensions for the WHMCS platform. 16 | 17 | For developers, it provides a great opportunity for you to get your creations exposure and visibility to potential users and customers. 18 | 19 | Submission is free, and we highly recommend submitting your creations to it. 20 | 21 | For more information, please visit [https://marketplace.whmcs.com](https://marketplace.whmcs.com) 22 | -------------------------------------------------------------------------------- /modules/style-guide.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/modules/marketplace/" 3 | prev = "/modules/code-samples/" 4 | title = "Style Guide" 5 | weight = 30 6 | 7 | +++ 8 | 9 | The following describes the recommended programming style and best practices when developing with WHMCS. 10 | 11 | ## PHP Code Tags 12 | 13 | Always use `` to delimit PHP code, not the shorthand, ``. This is the most portable format to ensure compatibility for differing operating systems and set-ups. 14 | 15 | If a file is pure PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag which may cause unwanted side effects including "header already sent" errors, XHTML/XML validation issues, and other problems. 16 | 17 | ## Indenting and whitespace 18 | 19 | Use an indent of 4 spaces, with no tabs. 20 | 21 | Lines should have no trailing whitespace at the end. 22 | 23 | Files should be formatted with `\n` as the line ending (Unix line endings), not `\r\n` (Windows line endings). 24 | 25 | All files should end in a single newline (\n). This avoids the verbose "\ No newline at end of file" warning and makes it clearer what is being changed when lines are added to the end of a file. 26 | 27 | ## PSR Coding Standards 28 | 29 | The PHP Standard Recommendation (PSR) is a PHP specification published by the PHP Framework Interop Group. It comprises what should be considered the standard coding elements that are required to ensure a high level of technical interoperability between shared PHP code. 30 | 31 | At WHMCS we follow the `PSR-1` and `PSR-2` standards for all code we create, and we strongly recommend you do the same: 32 | 33 | * Basic Coding Standard: http://www.php-fig.org/psr/psr-1/ 34 | * Coding Style Guide: http://www.php-fig.org/psr/psr-2/ 35 | 36 | ## Character Encoding 37 | 38 | All PHP files should be encoded using `UTF-8 without BOM` (no byte-order-mark). 39 | -------------------------------------------------------------------------------- /notification-providers/dynamic-fields.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/notification-providers/send-notification" 3 | prev = "/notification-providers/provider-settings" 4 | title = "Dynamic Fields" 5 | toc = true 6 | weight = 50 7 | 8 | +++ 9 | 10 | Dynamic fields are a special type of notification setting. 11 | 12 | A dynamic field is rendered as a dropdown menu and is recommended for settings where the list of options and choices need to be populated with a poll or fetch from a remote service or API. 13 | 14 | An example use case is demonstrated in our HipChat and Slack notification providers, where Dynamic Fields are used to provide a list of Channels and Rooms that are fetched in real-time from the respective APIs. 15 | 16 | Below is an example of a "channel" dynamic field. 17 | 18 | ``` 19 | public function notificationSettings() 20 | { 21 | return [ 22 | 'channel' => [ 23 | 'FriendlyName' => 'Notification Channel', 24 | 'Type' => 'dynamic', 25 | 'Description' => 'Choose the notification channel for the alert.', 26 | ], 27 | ]; 28 | } 29 | 30 | public function getDynamicField($fieldName, $settings) 31 | { 32 | $values = []; 33 | 34 | if ($fieldName == 'channel') { 35 | 36 | // Perform remote API call, query or database fetch and build an array: 37 | // 38 | // $values[] = [ 39 | // 'id' => '123', 40 | // 'name' => 'Demo Room', 41 | // 'description' => 'Room ID', 42 | // ]; 43 | 44 | } elseif ($fieldName == '...') { 45 | // .... 46 | } 47 | 48 | return [ 49 | 'values' => $values, 50 | ]; 51 | } 52 | ``` 53 | -------------------------------------------------------------------------------- /notification-providers/getting-started.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/notification-providers/initialisation" 3 | prev = "/notification-providers/index" 4 | title = "Getting Started" 5 | toc = true 6 | weight = 10 7 | 8 | +++ 9 | 10 | ## Sample Module 11 | 12 | The `Email` notification module that ships with WHMCS is not encoded so the source code is viewable. We recommend using this as a starting point for a custom module. This module can be found in the `/modules/notifications/Email` directory. 13 | 14 | ## Choosing a Name 15 | 16 | Notification Modules are stored in the `/modules/notifications/` directory. 17 | 18 | Each module has its own subdirectory within which all files relating to that module should be stored. 19 | 20 | At its simplest, a notification module is a PHP file containing a class that implements the [NotificationModuleInterface](https://docs.whmcs.com/classes/7.4/WHMCS/Module/Contracts/NotificationModuleInterface.html). 21 | 22 | To get started creating a new notification module, follow the steps below. 23 | 24 | 1. *Choose a name* for your module. Module names should be a single word, consisting of only letters and numbers. Names must begin with a letter, and must be unique. 25 | 2. *Create a new directory* using your desired module name. 26 | 3. *Create a new file* within the directory with the filename `Yourmodulename.php` 27 | 4. *Add the following code* to the file, replacing all instances of `Yourmodulename` with the name of your module as appropriate. 28 | 29 | ``` 30 | " 4 | title = "Notification Providers" 5 | next = "/notification-providers/getting-started" 6 | weight = 0 7 | 8 | +++ 9 | 10 | Notification Providers define how WHMCS can transmit notifications when Notification Rules are met. 11 | 12 | You can learn more about Notifications in WHMCS at https://docs.whmcs.com/Notifications 13 | -------------------------------------------------------------------------------- /notification-providers/initialisation.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/notification-providers/provider-settings" 3 | prev = "/notification-providers/getting-started" 4 | title = "Initialisation" 5 | toc = true 6 | weight = 20 7 | 8 | +++ 9 | 10 | Notification modules require a display name and logo to be defined for them. 11 | 12 | It is recommended to set these values during object instantiation. 13 | 14 | A [DescriptionTrait](https://docs.whmcs.com/classes/7.4/WHMCS/Module/Notification/DescriptionTrait.html) is made available which provides methods to fulfill this requirement. 15 | 16 | ``` 17 | use DescriptionTrait; 18 | 19 | /** 20 | * Constructor 21 | */ 22 | public function __construct() 23 | { 24 | $this->setDisplayName('Your Friendly Display Name') 25 | ->setLogoFileName('logo.png'); 26 | } 27 | ``` 28 | 29 | * The display name should be a human friendly version of your module name. 30 | * The logo filename should be a path relative to the base directory of the module. 31 | 32 | For more information on the description trait, please refer to https://docs.whmcs.com/classes/7.4/WHMCS/Module/Notification/DescriptionTrait.html 33 | -------------------------------------------------------------------------------- /notification-providers/notification-settings.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/notification-providers/dynamic-fields" 3 | prev = "/notification-providers/provider-settings" 4 | title = "Notification Settings" 5 | toc = true 6 | weight = 40 7 | 8 | +++ 9 | 10 | Notification Settings are configured on a per notification rule basis. 11 | 12 | Notification Settings should be used for user configurable settings that are specific to an individual notification. For settings that are the same for all notification rules, [Provider Settings](/notification-providers/provider-settings) should be used instead. 13 | 14 | In the case of our HipChat and Slack notification providers, examples of Notification Settings are fields for defining the Channel/Room to notify, as well as the ability to customise the notification message body. 15 | 16 | The field definitions you return from this method are used to build a form in the admin notification rule user interface. 17 | 18 | Supported field types are: text, password, yesno, dropdown, radio, textarea and dynamic. 19 | 20 | ``` 21 | public function notificationSettings() 22 | { 23 | return [ 24 | 'priority' => [ 25 | 'FriendlyName' => 'Notification Priority', 26 | 'Type' => 'dropdown', 27 | 'Options' => [ 28 | 'Low', 29 | 'Medium', 30 | 'High', 31 | ], 32 | 'Description' => 'Choose the notification priority for the alert.', 33 | ], 34 | ]; 35 | } 36 | ``` 37 | 38 | See also [Dynamic Fields](/notification-providers/dynamic-fields) 39 | -------------------------------------------------------------------------------- /oauth/api.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/oauth/further-reading" 3 | prev = "/oauth/auth-workflow/" 4 | title = "API Commands" 5 | toc = true 6 | weight = 12 7 | 8 | +++ 9 | 10 | The following API commands exist for interacting with OAuth/OpenID Connect credentials in WHMCS: 11 | 12 | * [ListOAuthCredentials](/api-reference/listoauthcredentials/) 13 | * [CreateOAuthCredential](/api-reference/createoauthcredential/) 14 | * [UpdateOAuthCredential](/api-reference/updateoauthcredential/) 15 | * [DeleteOAuthCredential](/api-reference/deleteoauthcredential/) 16 | -------------------------------------------------------------------------------- /oauth/auth-workflow.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/oauth/api/" 3 | prev = "/oauth/introduction" 4 | title = "Authentication Workflow" 5 | toc = true 6 | weight = 10 7 | 8 | +++ 9 | 10 | Here’s how the process typically works. 11 | 12 | 1. User presses a “Connect to WHMCS” button inside your app. 13 | 2. Your app redirects the user to the WHMCS installation. 14 | 3. The user logs into WHMCS and authorizes your app to access their WHMCS account using the permissions your app has requested. 15 | 4. After the user approves your app, they’ll be redirected back to your app with an authorization code. 16 | 5. Your app can then use this authorization code to make a request for a re-usable access token which can be used to make subsequent requests to the WHMCS API. This takes place in the background and should not be visible to end users. 17 | 18 | All OAuth requests require a valid API Client Credential Identifier and Secret. Credentials for OpenID connect can be created via the OpenID Connect admin interface. For Single Sign-On credentials, we recommend using the Provisioning Module API for Application Links. Alternatively, you can provision and manage OAuth Client Credentials via the WHMCS API. 19 | -------------------------------------------------------------------------------- /oauth/further-reading.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/oauth/api/" 3 | title = "Further Reading" 4 | toc = true 5 | weight = 15 6 | 7 | +++ 8 | 9 | For more information, please refer to: 10 | 11 | * [OpenID Connect User Guide](http://docs.whmcs.com/OpenID_Connect) 12 | * [OpenID Connect Developer Guide](http://docs.whmcs.com/OpenID_Connect_Developer_Guide) 13 | -------------------------------------------------------------------------------- /oauth/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | next = "/oauth/introduction" 5 | title = "OAuth" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ## Introduction 11 | 12 | OAuth enables third-party applications to obtain limited access to the WHMCS service on behalf of users. 13 | -------------------------------------------------------------------------------- /oauth/introduction.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/oauth/auth-workflow" 3 | prev = "/oauth/" 4 | title = "Introduction" 5 | toc = true 6 | weight = 5 7 | 8 | +++ 9 | 10 | If you have an app or service that needs to interact with WHMCS on behalf of your users, you should use OAuth. 11 | 12 | WHMCS uses OAuth 2, an open specification, which allows users to authenticate with WHMCS to both verify their identity and give your app permission to access their data. 13 | 14 | Once authorization is completed by a user, the OAuth process returns an access token to your app. The access token is a string generated by the WHMCS instance that you'll need to send with each subsequent API request to uniquely identify both your app and the end user. 15 | 16 | There are several reasons we use OAuth. Most importantly, your app doesn't need to store or transmit the user's WHMCS password. OAuth also allows the user to authorize only a limited set of permissions and the user may revoke access at any time. This makes OAuth a safer and more secure form of API authorization for your users. 17 | 18 | {{% notice info %}} 19 | OAuth is an open protocol we support in WHMCS for allowing third-party applications to obtain limited access to the WHMCS service on behalf of users. 20 | {{% /notice %}} 21 | -------------------------------------------------------------------------------- /payment-gateways/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | title = "Payment Gateways" 5 | next = "/payment-gateways/getting-started" 6 | weight = 0 7 | 8 | +++ 9 | 10 | Creating a payment gateway module allows you to connect and integrate WHMCS with additional payment service providers. 11 | 12 | The following guide assumes you have downloaded and are using one of the sample modules made available via our [GitHub page](https://github.com/whmcs). 13 | 14 | To get started, continue to the Getting Started page. 15 | -------------------------------------------------------------------------------- /payment-gateways/installation-activation.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/payment-gateways/tokenised-remote-storage" 3 | title = "Installation & Activation" 4 | toc = true 5 | weight = 120 6 | 7 | +++ 8 | 9 | To install the new module, upload it to the `/modules/gateways/` folder of your WHMCS installation. 10 | 11 | If the module includes a callback file, that should be uploaded to the `/modules/gateways/callback/` folder. 12 | 13 | Once uploaded, navigate to **Setup > Payment Gateways** to activate and configure the new module. 14 | 15 | {{% notice info %}} 16 | **Important Note** The process of activating a module detects the type of module that has been created. Therefore if you experience unexpected behaviours, please try deactivating and reactivating your module before continuing. 17 | {{% /notice %}} 18 | 19 | ## Troubleshooting errors during activation 20 | 21 | If you receive a blank page or error message within the **Setup > Payment Gateways** page upon uploading your new payment gateway module, this indicates there could be a syntax error within the new code. 22 | 23 | To debug this, you can turn on error reporting. To do this, navigate to **Setup > General Settings > Other** and check the **Display Errors** setting. 24 | 25 | This enables PHP error reporting and should show the cause of any issues. Once resolved, remember to disable Display Errors again. 26 | -------------------------------------------------------------------------------- /payment-gateways/meta-data-params.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/payment-gateways/getting-started" 3 | next = "/payment-gateways/configuration" 4 | title = "Metadata Parameters" 5 | toc = true 6 | weight = 20 7 | 8 | +++ 9 | 10 | The metadata function allows you to define module related capabilities and settings. 11 | 12 | Payment Gateway Modules support the following metadata configuration parameters. 13 | 14 | | Name | Type | Supported As Of | Default | Description | 15 | | ---- | ---- | --------------- | ------- | ----------- | 16 | | DisplayName | String | 6.0 | Module Name | An alternate display name that will be used instead of the filename if defined | 17 | | APIVersion | String | 5.2 | 1.1 | Defines API Version the module uses. Use `1.1` unless you have a need specific to use `1.0` | 18 | | gatewayType | String | 8.0 | *undefined* | This should be set to 'Bank' if the module is a Bank module, or the metadata should be omitted. | 19 | | failedEmail | String | 7.7 | Credit Card Payment Failed | The name of an email template to send should a payment capture fail | 20 | | successEmail | String | 7.7 | Credit Card Payment Confirmation | The name of an email template to send should a payment capture be successful | 21 | | pendingEmail | String | 7.7 | Credit Card Payment Pending | The name of an email template to send should a payment capture be pending | 22 | 23 | ### Example 24 | 25 | ``` 26 | function yourmodulename_MetaData() 27 | { 28 | return [ 29 | 'DisplayName' => 'Your Module Name', 30 | 'gatewayType' => 'Bank', // Only set if the module is a Bank Module 31 | 'failedEmail' => 'Credit Card Payment Failed', 32 | 'successEmail' => 'Custom Credit Card Payment Template', // You can utilise custom templates here 33 | 'pendingEmail' => 'Custom Credit Card Pending Template', 34 | 'APIVersion' => '1.1', // Use API Version 1.1 35 | ]; 36 | } 37 | 38 | ``` 39 | -------------------------------------------------------------------------------- /payment-gateways/reversals.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/payment-gateways/3d-secure" 3 | prev = "/payment-gateways/subscription-management" 4 | title = "Payment Reversals" 5 | toc = true 6 | weight = 80 7 | 8 | +++ 9 | 10 | WHMCS 7.2 and later supports payment reversal callbacks. 11 | 12 | If your payment gateway provider supports sending notifications when a payment dispute or chargeback is initiated, you can leverage this to have automated actions performed within WHMCS including reverting of next due date increments, changing the invoice status to Collections and sending administrative users an email notification. 13 | 14 | ## How it works 15 | 16 | Supported as part of the callback file, you can trigger a payment reversal action within WHMCS by executing the following function call. 17 | 18 | ``` 19 | /** 20 | * Reverse a payment. 21 | * 22 | * @param string $reverseTransactionId 23 | * @param string $originalTransactionId 24 | * 25 | * @throws Exception 26 | */ 27 | try { 28 | $reverseTransactionId = '10643229BD2660707'; 29 | $originalTransactionId = '7WA952319L375522P'; 30 | paymentReversed($reverseTransactionId, $originalTransactionId); 31 | } catch (\Exception $e) { 32 | // Transaction could not be found or already reversed 33 | $errorMessage = $e->getMessage(); 34 | } 35 | ``` 36 | 37 | There are two required input parameters: 38 | 39 | * `reverseTransactionId` - The unique transaction ID assigned to the reversal action 40 | * `originalTransactionId` - The unique transaction ID of the original transaction to be reversed 41 | 42 | The function will throw exceptions under the following conditions: 43 | 44 | * Multiple Original Transaction ID matches found - in the case of more than one transaction being found for a given original Transaction ID, the reversal cannot be processed automatically 45 | * Original Transaction Not Found - occurs when the original Transaction ID is not found in the database 46 | * Transaction Already Reversed - occurs when the original Transaction ID has already been refunded, or the reversal Transaction ID already exists in the database 47 | -------------------------------------------------------------------------------- /provisioning-modules/admin-dashboard-widgets.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/provisioning-modules/admin-services-tab" 3 | next = "/provisioning-modules/module-logging" 4 | title = "Admin Dashboard Widgets" 5 | toc = true 6 | weight = 100 7 | 8 | +++ 9 | 10 | Admin Dashboard Widgets are displayed on the admin area homepage. 11 | 12 | They allow you to provide convenient access to key information and functionality from your module within the admin homepage dashboard. 13 | 14 | Below is an example of how a dashboard widget is defined. 15 | 16 | ``` 17 | 45 | Hello World! 46 | 47 | EOF; 48 | } 49 | } 50 | ``` 51 | 52 | More information on the AbstractWidget class used in the above example can be found at http://docs.whmcs.com/classes/7.1/WHMCS/Module/AbstractWidget.html 53 | -------------------------------------------------------------------------------- /provisioning-modules/admin-services-tab.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/provisioning-modules/client-area-output" 3 | next = "/provisioning-modules/admin-dashboard-widgets" 4 | title = "Admin Services Tab" 5 | toc = true 6 | weight = 90 7 | 8 | +++ 9 | 10 | Admin Services Tab functions allow definition of extra fields to appear on the product details in the admin area. 11 | Used for informational output, or for settings and values stored in custom tables or outside WHMCS. 12 | 13 | WHMCS uses this in the core system for our licensing addon module. 14 | The license specific fields of the allowed system are set and viewed from the product details. 15 | 16 | There are 2 functions relating to the services tab - `AdminServicesTabFields` and `AdminServicesTabFieldsSave`. 17 | The first of these allows definition of the extra fields to output. 18 | The latter allows handling any input on submission/save, if required. 19 | 20 | So on to an example, below we show you how to define 4 extra fields. 21 | This example shows an input, dropdown, textarea and info only output. 22 | The examples continues to update them in a custom table of the database via the save event. 23 | 24 | ## Example Admin Services Tab Function 25 | 26 | ``` 27 | function mymodule_AdminServicesTabFields($params) { 28 | 29 | $result = select_query( 30 | "mod_customtable", 31 | "", 32 | array("serviceid" => $params['serviceid'],) 33 | ); 34 | $data = mysql_fetch_array($result); 35 | $var1 = $data['var1']; 36 | $var2 = $data['var2']; 37 | $var3 = $data['var3']; 38 | $var4 = $data['var4']; 39 | 40 | $fieldsarray = array( 41 | 'Field 1' => '', 42 | 'Field 2' => '', 44 | 'Field 4' => $var4, # Info Output Only 45 | ); 46 | return $fieldsarray; 47 | 48 | } 49 | 50 | function mymodule_AdminServicesTabFieldsSave($params) { 51 | update_query("mod_customtable",array( 52 | "var1"=>$_POST['modulefields'][0], 53 | "var2"=>$_POST['modulefields'][1], 54 | "var3"=>$_POST['modulefields'][2], 55 | ),array("serviceid"=>$params['serviceid'])); 56 | } 57 | ``` 58 | -------------------------------------------------------------------------------- /provisioning-modules/core-module-functions.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/provisioning-modules/module-parameters" 3 | next = "/provisioning-modules/single-sign-on" 4 | title = "Core Module Functions" 5 | toc = true 6 | weight = 40 7 | 8 | +++ 9 | 10 | The core module functions are **Create**, **Suspend**, **Unsuspend**, **Terminate**, **Renew**, **ChangePassword** and **ChangePackage**. 11 | 12 | These 7 functions all operate in a similar manner. They can run both manually and automatically. 13 | Each expected to return either a success or error response. 14 | 15 | ## Response Handling 16 | 17 | Each of these functions after running actions must either return a success or error. 18 | 19 | For a successful result the code must actually return the word "_success_" to end the function. 20 | When WHMCS receives "_success_" it knows the function completed and continues on that basis. 21 | 22 | Should the function fail, the return should be a user understandable error message, as it will display to staff users. 23 | 24 | ## Action Events 25 | 26 | When a function is successful, there are various actions that run as follows: 27 | 28 | * **CreateAccount** - Changes status to Active + Sends Product Welcome Email 29 | * **SuspendAccount** - Changes status to Suspended 30 | * **UnsuspendAccount** - Changes status to Active 31 | * **TerminateAccount** - Changes status to Terminated 32 | * **ChangePassword** - Updates password in database 33 | 34 | Besides the above actions, admin users receive a confirmation of functions completing, or errors in the case of failure. 35 | Functions invoked through automation, such as payment of a new order, that notification can be via email. 36 | In the case of ChangePassword, any errors returned are also displayed to client users. 37 | -------------------------------------------------------------------------------- /provisioning-modules/cpanel-advanced-mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHMCS/developer-docs/4ac5dfe89b1a085b04808f1199a5f04cf11bd9f9/provisioning-modules/cpanel-advanced-mode.png -------------------------------------------------------------------------------- /provisioning-modules/cpanel-simple-mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHMCS/developer-docs/4ac5dfe89b1a085b04808f1199a5f04cf11bd9f9/provisioning-modules/cpanel-simple-mode.png -------------------------------------------------------------------------------- /provisioning-modules/getting-started.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/provisioning-modules" 3 | next = "/provisioning-modules/config-options" 4 | title = "Getting Started" 5 | toc = true 6 | weight = 10 7 | 8 | +++ 9 | 10 | ## GitHub 11 | 12 | We make available a sample provisioning module on GitHub. We recommend using this as a starting point for a custom module. 13 | 14 | > https://github.com/WHMCS/sample-provisioning-module 15 | 16 | ## Choosing a Name 17 | 18 | Provisioning Modules are located in the `/modules/servers/` directory. 19 | 20 | {{% notice info %}} 21 | Module names should be a single word, consisting of only lowercase letters and numbers. The name must start with a letter, and must be unique. 22 | {{% /notice %}} 23 | -------------------------------------------------------------------------------- /provisioning-modules/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | next = "/provisioning-modules/getting-started" 5 | title = "Provisioning Modules" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ## Introduction 11 | 12 | Provisioning Modules, enable provisioning and management of services in WHMCS. 13 | 14 | Provisioning Modules are also referred to as Product or Server Modules. 15 | 16 | The core function of a module is creating, suspending, unsuspending, and terminating of products. 17 | This happens as various events occur. 18 | These events include: 19 | 20 | * New order payment 21 | * Items becoming overdue 22 | * Overdue invoice payment 23 | * Cancellation requests. 24 | 25 | A WHMCS module can do much more than just that including: 26 | 27 | * Automated password resets. 28 | * Upgrades/downgrades. 29 | * Renewals. 30 | * Admin based links. 31 | * Client area output. 32 | * Metric data for Usage Billing 33 | * And more via custom functions. 34 | -------------------------------------------------------------------------------- /provisioning-modules/module-logging.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/provisioning-modules/admin-dashboard-widgets" 3 | next = "/provisioning-modules/server-sync" 4 | title = "Module Logging" 5 | toc = true 6 | weight = 110 7 | 8 | +++ 9 | 10 | To make reviewing and debugging module calls easier, WHMCS has a built in logging function. 11 | This allows the record of the request and response strings for every call the module makes. 12 | This becomes available in an accessible way via the WHMCS admin interface. 13 | If you plan to release the module, this allows end users to troubleshoot and debug issues experienced using the module. 14 | This also allows you to be able to debug issues experienced while using it. 15 | 16 | Logging is not something that is always enabled. 17 | This is to avoid logs growing too large, so it's something that needs enabling for the logging to occur. 18 | To toggle logging, goto **Configuration** > **System Logs** > **Module Log**. 19 | This is the same place to review the logs. 20 | 21 | To utilise this functionality, the module needs to make a call as follows: 22 | 23 | ``` 24 | /** 25 | * Log module call. 26 | * 27 | * @param string $module The name of the module 28 | * @param string $action The name of the action being performed 29 | * @param string|array $requestString The input parameters for the API call 30 | * @param string|array $responseData The response data from the API call 31 | * @param string|array $processedData The resulting data after any post processing (eg. json decode, xml decode, etc...) 32 | * @param array $replaceVars An array of strings for replacement 33 | */ 34 | logModuleCall($module, $action, $requestString, $responseData, $processedData, $replaceVars); 35 | ``` 36 | 37 | We recommend passing data strings such as usernames and passwords into the `$replaceVars` parameter to allow them to be automatically scrubbed and omitted from module log entries. 38 | -------------------------------------------------------------------------------- /provisioning-modules/simple-mode.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/provisioning-modules/config-options" 3 | next = "/provisioning-modules/loader-functions" 4 | title = "Simple Mode" 5 | toc = true 6 | weight = 18 7 | 8 | +++ 9 | 10 | Simple Configuration Mode is a feature available to module developers to simplify the configuration process for a module. 11 | 12 | Using Simple Mode allows you to reduce the number of Module Setting fields that are shown to end users by default. For example, you can restrict the default Module Settings view to just the most common fields that a user needs to customise when creating a product assigned to your module, and have the other less commonly used fields only be shown if the user switches to Advanced Mode. 13 | 14 | The screenshots below shows the difference in Simple and Advanced Modes for the cPanel module. 15 | 16 | ## Simple Mode 17 | 18 | ![Simple Mode](cpanel-simple-mode.png) 19 | 20 | ## Advanced Mode 21 | 22 | ![Advanced Mode](cpanel-advanced-mode.png) 23 | 24 | To enable Simple Mode for your module, all you need to do is set an additional parameter in your Module Setting field definitions that you wish to appear in Simple Mode. Below is an example of a module with two fields, one in Simple Mode, and the other only shown when in Advanced Mode: 25 | 26 | ``` 27 | function provisioningmodule_ConfigOptions($params) 28 | { 29 | return [ 30 | 'Simple Mode Field' => [ 31 | 'Type' => 'text', 32 | 'Size' => '25', 33 | 'SimpleMode' => true, 34 | ], 35 | 'Advanced Mode Field' => [ 36 | 'Type' => 'text', 37 | 'Size' => '25', 38 | ], 39 | ]; 40 | } 41 | ``` 42 | -------------------------------------------------------------------------------- /themes/conditionals.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/themes/functions/" 3 | next = "/themes/php/" 4 | title = "Conditionals" 5 | toc = true 6 | weight = 70 7 | 8 | +++ 9 | 10 | It is often necessary to display text or messages when certain conditions are met. 11 | 12 | {if} statements in Smarty have much the same flexibility as PHP if statements. 13 | 14 | Every {if} must be paired with a matching {/if}. {else} and {elseif} are also permitted. 15 | 16 | All PHP conditionals and functions are recognized, such as `||`, `or`, `&&`, `and`, `is_array()`, etc. 17 | 18 | ## Example 19 | 20 | ``` 21 | {if $filename eq "announcements.php"} 22 | This is the announcements page 23 | {else} 24 | This is not the announcements page 25 | {/if} 26 | ``` 27 | 28 | For more information, please refer to http://www.smarty.net/docs/en/language.function.if.tpl 29 | -------------------------------------------------------------------------------- /themes/css-styling.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/themes/navigation/" 3 | prev = "/themes/customising/" 4 | title = "CSS Styling" 5 | toc = true 6 | weight = 30 7 | 8 | +++ 9 | 10 | ## Custom CSS 11 | 12 | If you want to make changes to any of the CSS that is applied by default, we recommend creating a `css/custom.css` file and making those customisations within it. This file is included after `styles.css`, allowing you to override any of the CSS defined within it. It will not be affected by future updates to the WHMCS software. 13 | 14 | {{% notice tip %}} 15 | * We strongly recommend creating a `css/custom.css` file to contain your additional custom CSS rules and **not** editing `css/styles.css` directly because it will make updating easier. 16 | * You may also wish to consider creating a [child theme](/themes/child-themes/). 17 | {{% /notice %}} 18 | 19 | ## Using Font Awesome 20 | 21 | To use Font Awesome icons, you may include the latest Font Awesome release shipped with WHMCS by including the line below within the `` section of your template: 22 | 23 | `` 24 | 25 | Themes that do not include the above line will have it injected automatically. If you wish to prevent this behaviour, include the following line: 26 | 27 | `` 28 | -------------------------------------------------------------------------------- /themes/debugging.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/themes/testing/" 3 | next = "/themes/smarty/" 4 | title = "Debugging" 5 | toc = true 6 | weight = 90 7 | 8 | +++ 9 | 10 | ## Causes of Errors 11 | 12 | The most common error in custom system theme and order form template development, syntax errors in template files, can cause a page to be unable to render completely. 13 | 14 | Other causes of errors include: 15 | 16 | * Using features of Smarty that have been removed in the upstream Smarty package. 17 | * An incompatible custom or third-party module. 18 | * Using PHP code blocks without the **Allow Smarty PHP Tags** setting enabled at **Configuration > System Settings > General Settings** in the **Security** tab. 19 | 20 | ## Troubleshooting 21 | 22 | If you see a blank page after making a change to a template file, check for any logged error messages in the **Activity Log** at **Configuration > System Logs**. 23 | 24 | {{% notice tip %}} 25 | If you don't find anything in the activity logs, switching to a different system theme or order form template is an easy way to determine if the issue is with your system theme or order form template, or if the problem is something else. 26 | {{% /notice %}} 27 | 28 | If you find a variable is not correctly being populated and displayed within a template, this may indicate the variable does not exist or is not available within the template it is being utilised in. Adding `{debug}` to the template file and accessing the page that calls that template in a browser will result in a popup list of all available variables within that template, allowing you to determine if that variable is available. 29 | 30 | {{% notice tip %}} 31 | For a full list of all template variables made available to all system themes and order form templates, see [Variables](/themes/variables/). 32 | {{% /notice %}} -------------------------------------------------------------------------------- /themes/functions.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/themes/variables/" 3 | next = "/themes/conditionals/" 4 | title = "Functions" 5 | toc = true 6 | weight = 60 7 | 8 | +++ 9 | 10 | ### Replace 11 | 12 | This is a shorthand version of the `str_replace` function. Use it to replace a value in a string. 13 | 14 | ``` 15 | {$variable_name|replace:'hello':'world'} 16 | ``` 17 | 18 | ### Count 19 | 20 | Use this to count the number of entries in an array. 21 | 22 | ``` 23 | {$variable_name|count} 24 | ``` 25 | -------------------------------------------------------------------------------- /themes/github.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/themes/smarty/" 3 | title = "GitHub" 4 | toc = true 5 | weight = 150 6 | 7 | +++ 8 | 9 | The default system themes and order form templates are [available as read-only repositories on GitHub](https://github.com/WHMCS/). 10 | 11 | For example, you may wish to fork these system themes and order form templates: 12 | 13 | ## System Templates 14 | 15 | WHMCS ships with two Client Area themes: 16 | 17 | * [Twenty-One](https://github.com/WHMCS/templates-twenty-one) (WHMCS 8.1 and later) 18 | * [Six](https://github.com/WHMCS/templates-six) 19 | 20 | We recommend using **Twenty-One** for new development. 21 | 22 | ## Order Form Templates 23 | 24 | [Standard Cart](https://github.com/WHMCS/orderforms-standard_cart) is the default shopping cart template in WHMCS. 25 | -------------------------------------------------------------------------------- /themes/index.md: -------------------------------------------------------------------------------- 1 | +++ 2 | chapter = true 3 | icon = "" 4 | next = "/themes/getting-started" 5 | title = "Themes" 6 | weight = 0 7 | 8 | +++ 9 | 10 | ## Introduction 11 | 12 | System themes and order form templates let you control the Client Area, the client-facing user interface in WHMCS. WHMCS allows you to provide a seamless experience for your customers by customising the look of the Client Area to match your company's website and branding. 13 | 14 | ## System Themes 15 | 16 | Themes, or *System Themes*, in WHMCS control the client-facing user interface. WHMCS allows you to provide a seamless experience for your website visitors by using system themes to customise the Client Area to match the rest of your website. 17 | 18 | WHMCS currently ships with two system themes for the Client Area: 19 | 20 | * **Twenty-One** was introduced in WHMCS 8.1 and is currently the default system theme for new installations. 21 | * **Six** was the default theme for WHMCS 6.0 through 8.0. 22 | 23 | We recommend using and customising **Twenty-One**. We will remove **Six** in a future version of WHMCS. 24 | 25 | {{% notice tip %}} 26 | We recommend using [Child Themes](/themes/child-themes/) for your customisations. 27 | {{% /notice %}} 28 | 29 | You can set the **System Theme** in WHMCS's Admin Area at **Configuration > System Settings > General Settings** in the **General** tab. 30 | 31 | ## Order Form Templates 32 | 33 | Order form templates control the look and feel of individual product and shopping cart pages in the Client Area. 34 | 35 | You can set a **Default Order Form Template** at **Configuration > System Settings > General Settings** in the **Ordering** tab. You can also select an order form template for individual product groups at **Configuration > System Settings > Products/Services**. 36 | 37 | In WHMCS 8.1 and later, WHMCS automatically checks for compatibility between your **System Theme** and the order form templates you use. 38 | 39 | For more information about order form templates, see [Order Form Templates](/themes/order-form-templates/). 40 | -------------------------------------------------------------------------------- /themes/navigation/menus-find-name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHMCS/developer-docs/4ac5dfe89b1a085b04808f1199a5f04cf11bd9f9/themes/navigation/menus-find-name.png -------------------------------------------------------------------------------- /themes/sidebars/find-sidebar-name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WHMCS/developer-docs/4ac5dfe89b1a085b04808f1199a5f04cf11bd9f9/themes/sidebars/find-sidebar-name.png -------------------------------------------------------------------------------- /themes/smarty.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/themes/debugging/" 3 | next = "/themes/github/" 4 | title = "Smarty" 5 | toc = true 6 | weight = 100 7 | 8 | +++ 9 | 10 | WHMCS uses the Smarty templating engine. 11 | 12 | Smarty is a fast and powerful templating system with a vast array of functionality that makes working with WHMCS templates easy and flexible. 13 | 14 | ## Smarty 3 Manual 15 | 16 | Visit the Smarty 3 manual below: 17 | 18 | {{% button href="http://www.smarty.net/docs/en/" target="_blank" %}} Launch Smarty Documentation{{% /button %}} 19 | -------------------------------------------------------------------------------- /themes/testing.md: -------------------------------------------------------------------------------- 1 | +++ 2 | next = "/themes/debugging/" 3 | prev = "/themes/php/" 4 | title = "Testing" 5 | toc = true 6 | weight = 80 7 | 8 | +++ 9 | 10 | ## Testing Your Customizations 11 | 12 | WHMCS allows you to preview themes and Order Form Templates before making them live. This is done using URL parameters. 13 | 14 | * For themes, use the `?systpl=xxxx` URL parameter. 15 | * For Order Form Templates, use the `?carttpl=xxxx` URL parameter. 16 | 17 | For example, to preview a custom system theme named `mytemplate` in a WHMCS Client Area at `http://www.yourdomain.com/whmcs/`, you would navigate to: 18 | 19 | ``` 20 | http://www.yourdomain.com/whmcs/?systpl=mytemplate 21 | ``` 22 | 23 | When you view a system theme or order form template through this method, the system will validate whether all of the theme or order form template's dependencies are met. If they aren't, the page will not display. 24 | 25 | If the dependencies were met and the theme or order form template displayed successfully, the system theme or Order Form Template will be stored for the duration of your browser session, allowing you to exercise all areas of the Client Area with your new system theme. 26 | 27 | ## Activating Themes 28 | 29 | Once you're happy with your new theme and are ready to make it live, follow the steps below: 30 | 31 | 1. Log in to your WHMCS Admin Area. 32 | 2. Navigate to **Configuration > System Settings > General Settings**. 33 | 3. Under the **System Theme** setting on the **General** tab, select the name of the theme you created above. 34 | 4. Click **Save Changes** and visitors to your site will immediately begin seeing your new theme. 35 | 36 | Visitors to your site will immediately seeing your new system theme. 37 | 38 | ## Activating Order Form Templates 39 | 40 | There are two places in the WHMCS Admin Area in which you can set Order Form Templates: 41 | 42 | * You can set the system default Order Form Template at **Configuration > System Settings > General Settings** in the **Ordering** tab. 43 | * You can set the Order Form Template for specific product groups at **Configuration > System Settings > Products/Services**. 44 | -------------------------------------------------------------------------------- /themes/variables.md: -------------------------------------------------------------------------------- 1 | +++ 2 | prev = "/themes/navigation/" 3 | next = "/themes/functions/" 4 | title = "Variables" 5 | toc = true 6 | weight = 50 7 | 8 | +++ 9 | 10 | ## Variables 11 | 12 | In the Smarty template language, template variables take the format `{$variable_name}`. 13 | 14 | ## Template Parameters 15 | 16 | The following template parameters are made available to all system themes and order form templates: 17 | 18 | | Parameter | Description | 19 | | --------- | ----------- | 20 | | {$BASE_PATH_CSS} | The base URL to common CSS assets. | 21 | | {$BASE_PATH_FONTS} | The base URL to common font assets. | 22 | | {$BASE_PATH_IMG} | The base URL to common image assets. | 23 | | {$BASE_PATH_JS} | The base URL to common JavaScript assets. | 24 | | {$charset} | The configured character set. | 25 | | {$client} | The currently logged in client, or `null` if a client is not logged in. | 26 | | {$companyname} | The configured company name. | 27 | | {$date_day} | The current calendar day. | 28 | | {$date_month} | The current calendar month. | 29 | | {$date_year} | The current calendar year. | 30 | | {$filename} | The base name of the current file requested by the web browser. | 31 | | {$language} | The name of the language to display to the user. | 32 | | {$loggedin} | `true` or `false` depending on whether a client is logged in. | 33 | | {$logo} | The path to the configured logo image. | 34 | | {$pagetitle} | The current page's title. | 35 | | {$reCaptchaPublicKey} | The configured reCAPTCHA site key. This can be an empty string if the WHMCS installation does not use Google reCAPTCHA. | 36 | | {$systemNonSSLURL} | The configured non-SSL URL. | 37 | | {$systemsslurl} | The configured SSL URL. | 38 | | {$systemurl} | The URL to the WHMCS system. This is either the SSL or non-SSL URL depending on whether the current page loaded via HTTPS. | 39 | | {$template} | The name of the system theme used for display. | 40 | | {$todaysdate} | The current date, presented in `l, jS F Y` format. | 41 | | {$token} | A CSRF token to use on POST forms. | 42 | | {$WEB_ROOT} | Your WHMCS system's base URL. | 43 | 44 | For a complete listing of all variables available to you in a given template file, add the following line to your template file. Then, use a browser to access the page that calls the template. You will receive a popup list of all available template data. 45 | 46 | ``` 47 | {debug} 48 | ``` 49 | --------------------------------------------------------------------------------