Class: Orders

Orders(config)

Allows you to manage your orders module in WHMCS.

Constructor

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

acceptOrder(opts)

Accepts a pending order - https://developers.whmcs.com/api-reference/acceptorder/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
orderid Number The order id to be accepted
serverid Number <optional>
The specific server to assign to products within the order
serviceusername String <optional>
The specific username to assign to products within the order
servicepassword String <optional>
The specific password to assign to products within the order
registrar String <optional>
The specific registrar to assign to domains within the order
sendregistrar Boolean <optional>
Send the request to the registrar to register the domain.
autosetup Boolean <optional>
Send the request to the product module to activate the service. This can override the product configuration.
sendemail Boolean <optional>
Send any automatic emails. This can be Product Welcome, Domain Renewal, Domain Transfer etc.
Source:

addOrder(opts)

Adds an order to a client. - https://developers.whmcs.com/api-reference/addorder/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
clientid Number
paymentmethod String The payment method for the order in the system format. eg. paypal, mailin
pid Array.<Number> <optional>
The array of product ids to add the order for
domain Array.<String> <optional>
The array of domain names associated with the products/domains
billingcycle Array.<String> <optional>
The array of billing cycles for the products
domaintype Array.<String> <optional>
For domain registrations, an array of register or transfer values
regperiod Array.<Number> <optional>
For domain registrations, the registration periods for the domains in the order
eppcode Array.<String> <optional>
For domain transfers. The epp codes for the domains being transferred in the order
nameserver1 String <optional>
The first nameserver to apply to all domains in the order
nameserver2 String <optional>
The second nameserver to apply to all domains in the order
nameserver3 String <optional>
The third nameserver to apply to all domains in the order
nameserver4 String <optional>
The fourth nameserver to apply to all domains in the order
nameserver5 String <optional>
The fifth nameserver to apply to all domains in the order
customfields Array.<String> <optional>
an array of base64 encoded serialized array of product custom field values
configoptions Array.<String> <optional>
an array of base64 encoded serialized array of product configurable options values
priceoverride Array.<Number> <optional>
Override the price of the product being ordered
promocode String <optional>
The promotion code to apply to the order
promooverride Boolean <optional>
Should the promotion apply to the order even without matching promotional products
affid Number <optional>
The affiliate id to associate with the order
noinvoice Boolean <optional>
Set to true to suppress the invoice generating for the whole order
noinvoiceemail Boolean <optional>
Set to true to suppress the Invoice Created email being sent for the order
noemail Boolean <optional>
Set to true to suppress the Order Confirmation email being sent
addons Array.<String> <optional>
A comma separated list of addons to create on order with the products
hostname Array.<String> <optional>
The hostname of the server for VPS/Dedicated Server orders
ns1prefix Array.<String> <optional>
The first nameserver prefix for the VPS/Dedicated server. Eg. ns1 in ns1.hostname.com
ns2prefix Array.<String> <optional>
The second nameserver prefix for the VPS/Dedicated server. Eg. ns2 in ns2.hostname.com
rootpw Array.<String> <optional>
The desired root password for the VPS/Dedicated server.
contactid Number <optional>
The id of the contact, associated with the client, that should apply to all domains in the order
dnsmanagement Array.<Boolean> <optional>
Add DNS Management to the Domain Order
domainfields Array.<String> <optional>
an array of base64 encoded serialized array of TLD Specific Field Values
emailforwarding Array.<Boolean> <optional>
Add Email Forwarding to the Domain Order
idprotection Array.<Boolean> <optional>
Add ID Protection to the Domain Order
domainpriceoverride Array.<Number> <optional>
Override the price of the registration price on the domain being ordered
domainrenewoverride Array.<Number> <optional>
Override the price of the renewal price on the domain being ordered
domainrenewals Array <optional>
A name -> value array of $domainName -> $renewalPeriod renewals to add an order for
clientip String <optional>
The ip address to associate with the order
addonid Number <optional>
The Addon ID for an Addon Only Order
serviceid Number <optional>
The service ID for the addon only order
addonids Array.<Number> <optional>
An Array of addon ids for an Addon Only Order
serviceids Array.<Number> <optional>
An array of service ids to associate the addons for an Addon Only order
Source:

cancelOrder(opts)

Cancel a Pending Order - https://developers.whmcs.com/api-reference/cancelorder/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
orderid Number The ID of the pending order
cancelsub Boolean <optional>
Attempt to cancel the subscription associated with the products
noemail Boolean <optional>
Set to true to stop the invoice payment email being sent if the invoice becomes paid
Source:

deleteOrder(opts)

Removes an order from the system. This cannot be undone. This will remove all items associated with the order (services, addons, domains, invoices etc) - https://developers.whmcs.com/api-reference/deleteorder/
Parameters:
Name Type Description
opts Object
Properties
Name Type Description
orderid Number The order to be deleted
Source:

fraudOrder(opts)

Marks an order as fraudulent. - https://developers.whmcs.com/api-reference/fraudorder/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
orderid Number The Order ID to set as fraud
cancelsub Boolean <optional>
Pass as true to cancel any PayPal Subscription(s) associated with the products & services that belong to the given order.
Source:

getOrders(opts)

Obtain orders matching the passed criteria - https://developers.whmcs.com/api-reference/getorders/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
limitstart Number <optional>
The offset for the returned order data (default: 0)
limitnum Number <optional>
The number of records to return (default: 25)
id Number <optional>
Find orders for a specific id
userid Number <optional>
Find orders for a specific client id
status String <optional>
Find orders for a specific status
Source:

getOrderStatuses(opts)

Retrieve Order Status and number in those statuses - https://developers.whmcs.com/api-reference/getorderstatuses/
Parameters:
Name Type Description
opts Object
Source:

getProducts(opts)

NOTE: This API method is designed to be used in the building of custom order forms. As a result, only custom fields that have the ‘Show on Order Form’ setting enabled will be returned for a given product. - https://developers.whmcs.com/api-reference/getproducts/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
pid Number <optional>
string
gid Number <optional>
Retrieve products in a specific group id
module String <optional>
Retrieve products utilising a specific module
Source:

getPromotions(opts)

Obtain promotions matching the passed criteria - https://developers.whmcs.com/api-reference/getpromotions/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
code String <optional>
Retrieve a specific promotion code. Do not pass to retrieve all
Source:

orderFraudCheck(opts)

Run a fraud check on a passed Order ID - https://developers.whmcs.com/api-reference/orderfraudcheck/
Parameters:
Name Type Description
opts Object
Properties
Name Type Attributes Description
orderid Number The order id to complete the fraud check on
ipaddress String <optional>
To override the IP address on the fraud check
Source:

pendingOrder(opts)

Sets an order, and all associated order items to Pending status - https://developers.whmcs.com/api-reference/pendingorder/
Parameters:
Name Type Description
opts Object
Properties
Name Type Description
orderid Number The order id to be accepted
Source: