Class: Services

Services(config)

Allows you to manage your Services module in WHMCS.

Constructor

new Services(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

moduleChangePackage(opts)

Runs a change package action for a given service. - https://developers.whmcs.com/api-reference/modulechangepackage/
Parameters:
Name Type Description
opts Object
Properties
Name Type Description
serviceid Number The service ID to run the action for
Source:

moduleChangePw(opts)

Runs a change password action for a given service. - https://developers.whmcs.com/api-reference/modulechangepw/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
serviceid Number The service ID to run the action for
servicepassword String <optional>
A new password to assign to the service
Source:

moduleCreate(opts)

Runs the module create action for a given service. - https://developers.whmcs.com/api-reference/modulecreate/
Parameters:
Name Type Description
opts Object
Properties
Name Type Description
serviceid Number The service ID to run the action for
Source:

moduleCustom(opts)

Runs a custom module action for a given service. - https://developers.whmcs.com/api-reference/modulecustom/
Parameters:
Name Type Description
opts Object
Properties
Name Type Description
serviceid Number The service ID to run the action for
func_name String The name of the custom function to run
Source:

moduleSuspend(opts)

Runs the module suspend action for a given service. - https://developers.whmcs.com/api-reference/modulesuspend/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
serviceid Number The service ID to run the action for
suspendreason String <optional>
A reason for the suspension
Source:

moduleTerminate(opts)

Runs a terminate action for a given service. - https://developers.whmcs.com/api-reference/moduleterminate/
Parameters:
Name Type Description
opts Object
Properties
Name Type Description
serviceid Number The service ID to run the action for
Source:

moduleUnsuspend(opts)

Runs an unsuspend action for a given service. - https://developers.whmcs.com/api-reference/moduleunsuspend/
Parameters:
Name Type Description
opts Object
Properties
Name Type Description
serviceid Number The service ID to run the action for
Source:

updateClientProduct(opts)

Updates a Client Service - https://developers.whmcs.com/api-reference/updateclientproduct/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
serviceid Number The id of the client service to update
pid Number <optional>
The package id to associate with the service
serverid Number <optional>
The server id to associate with the service
nextduedate String <optional>
The next due date of the service (Y-m-d)
terminationDate String <optional>
Update the termination date of the service (Y-m-d)
completedDate String <optional>
Update the completed date of the service (Y-m-d)
domain String <optional>
The domain name to be changed to
firstpaymentamount Number <optional>
The first payment amount on the service
recurringamount Number <optional>
The recurring amount for automatic renewal invoices
paymentmethod String <optional>
The payment method to associate in system format (eg paypal)
billingcycle String <optional>
The term in which the product is billed on (eg One-Time, Monthly, Quarterly, etc)
subscriptionid String <optional>
The subscription ID to associate with the service
status String <optional>
The status to change the service to
notes String <optional>
The admin notes for the service
serviceusername String <optional>
The service username
servicepassword String <optional>
The service password
overideautosuspend String <optional>
Should override auto suspend be provided (‘on’ or ‘off’)
overidesuspenduntil String <optional>
Update the Override Suspend date of the service (Y-m-d)
ns1 String <optional>
(VPS/Dedicated servers only)
ns2 String <optional>
(VPS/Dedicated servers only)
dedicatedip String <optional>
assignedips String <optional>
(VPS/Dedicated servers only)
diskusage Number <optional>
The disk usage in bytes
disklimit Number <optional>
The disk limit in bytes
bwusage Number <optional>
The bandwidth usage in bytes
bwlimit Number <optional>
The bandwidth limit in bytes
overidesuspenduntil String <optional>
suspendreason String <optional>
promoid Number <optional>
The promotion Id to associate
unset Array <optional>
An array of items to unset. Can be one of: ‘domain’, ‘serviceusername’, ‘servicepassword’, ‘subscriptionid’, ‘ns1’, ‘ns2’, ‘dedicatedip’, ‘assignedips’, ‘notes’, ‘suspendreason’
autorecalc Boolean <optional>
Should the recurring amount of the service be automatically recalculated (this will ignore any passed $recurringamount)
customfields String <optional>
Base64 encoded serialized array of custom field values - base64_encode(serialize(array(“1”=>“Yahoo”)));
configoptions String <optional>
Base64 encoded serialized array of configurable option field values - base64_encode(serialize(array(configoptionid => dropdownoptionid, XXX => array(‘optionid’ => YYY, ‘qty’ => ZZZ)))) - XXX is the ID of the configurable option - YYY is the optionid found in tblhostingconfigoption.optionid - ZZZ is the quantity you want to use for that option
Source:

upgradeProduct(opts)

Upgrade, or calculate an upgrade on, a product - https://developers.whmcs.com/api-reference/upgradeproduct/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
serviceid Number The ID of the service to update
calconly Boolean <optional>
Only calculate the upgrade amount
paymentmethod String The upgrade payment method in system format (e.g. paypal)
type String The type of upgrade (‘product’, ‘configoptions’)
newproductid Number <optional>
The Id of the new product
newproductbillingcycle String <optional>
The new products billing cycle
promocode String <optional>
The promotion code to apply to the upgrade
configoptions Array <optional>
An array of config options to upgrade
configoptions[id] Number <optional>
The id of the config option
configoptions[optiontype] Number <optional>
The config option type
configoptions[selectedvalue] Number <optional>
The config option selected value
configoptions[selectedqty] Number <optional>
The config option quantity selected
Source: