Class: Products

Products(config)

Allows you to manage your products module in WHMCS.

Constructor

new Products(config)

Parameters:
Name Type Description
config Object Object containing your API credentials.
Properties
Name Type Attributes Description
serverUrl string URL to your installation. Remember to point to /includes/api.php
username string <optional>
password string <optional>
identifier string <optional>
secret string <optional>
Source:

Extends

  • WHMCS

Methods

addProduct(opts)

Adds a product to the system to be available for purchase - https://developers.whmcs.com/api-reference/addproduct/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
name String The name of the product to be added
gid Number The id of the product group to add the product
type String <optional>
One of ‘hostingaccount’, ‘reselleraccount’, ‘server’ or ‘other’
stockcontrol Boolean <optional>
Set to true to enable stock control on the product
qty Number <optional>
How much of this product is in stock
paytype String <optional>
The payment type of the product. One of ‘free’, ‘onetime’, ‘recurring’
hidden Boolean <optional>
Should the product be hidden from the client order form
showdomainoptions Boolean <optional>
Should the product show the domain registration options.
tax Boolean <optional>
Does tax apply to the product.
isFeatured Boolean <optional>
Should the product be featured in the Product Group.
proratabilling Boolean <optional>
Is pro-rata billing enabled for this product.
description String <optional>
The description of the product to show on the product listing in the cart
welcomeemail Number <optional>
The id of the Email Template to use as the welcome email. Product/Service Messages only
proratadate Number <optional>
See https://docs.whmcs.com/Products_and_Services#Pricing_Tab
proratachargenextmonth Number <optional>
See https://docs.whmcs.com/Products_and_Services#Pricing_Tab
subdomain String <optional>
A comma separated list of subdomains to offer on the domain register page. eg: .domain1.com,.domain2.com
autosetup String <optional>
When should the product be automatically setup. One of “ (never), ‘on’ (pending order), ‘payment’ (on payment), ‘order’ (on order)
module String <optional>
The server module system name to associate with the product. eg: cpanel, autorelease, plesk
servergroupid Number <optional>
The server group id used on product creation to associate an appropriate server
configoption1 Mixed <optional>
The first module configuration value
configoption2 Mixed <optional>
The second module configuration value
configoption3 Mixed <optional>
The third module configuration value
configoption4 Mixed <optional>
The fourth module configuration value
configoption5 Mixed <optional>
The fifth module configuration value
configoption6 Mixed <optional>
The sixth module configuration value
order Number <optional>
The order to in which to display on the order form
pricing Array <optional>
The pricing array to associate with the product. format $pricing[currencyid]cycle
Source: