I have read the API docs, and I have a few clients that use a custom script to add and remove accounts from their profile. One of my hosting companies adds and removes accounts between 50 - 100 times per week. How this is done is by using a custom script I have created to enter and remove orders from our old billing system by entering the domain name.
So if this hosting company would like to add a product, pretty simple, this is what I am doing:
I do realize that it is putting the domain in 2 areas (the domain field and the custom field) this will change eventually.
This works great, it will add a new account to their order and work just fine. Where the problem comes into play is when they need to remove that account, the deleteorder API call needs the order number, I have a paste of the array that is being returned from WHMCS with the getorders here: /http://pastebin.com/6CqYuGzu
How do I get the order number for the domain they are trying to remove so I can use the deleteorder API command to remove the specific order? Any suggestions?
Thanks,
Jeff
So if this hosting company would like to add a product, pretty simple, this is what I am doing:
PHP Code:
$data["username"] = "xxxxxx";
$data["password"] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$data['action'] = 'addorder';
$data['clientid'] = '66';
$data["pid"] = "6";
$data["domain"] = $domain;
$data["priceoverride"] = '4';
$data["billingcycle"] = "monthly";
$data["customfields"] = base64_encode(serialize(array("1"=>"Google", "Domain Name"=>$domain)));
$data["regperiod"] = "1";
$data["paymentmethod"] = "mailin";
$data["noemail"] = "true";
$data["noinvoiceemail"] = "true";
$data["noinvoice"] = "true";
$create = whmcsapi($data);
if ($create["result"]=="success"){
$postfields["username"] = "slapiuser";
$postfields["password"] = "e3548a9b2b839959a61d78579cbe3a18";
$postfields["action"] = 'acceptorder';
$postfields["orderid"] = $create['orderid'];
$postfields["sendemail"] = false;
$activate = whmcsapi($postfields);
if ($results['result'] == 'success'){
echo "Adding account was successful";
}
}
}
This works great, it will add a new account to their order and work just fine. Where the problem comes into play is when they need to remove that account, the deleteorder API call needs the order number, I have a paste of the array that is being returned from WHMCS with the getorders here: /http://pastebin.com/6CqYuGzu
How do I get the order number for the domain they are trying to remove so I can use the deleteorder API command to remove the specific order? Any suggestions?
Thanks,
Jeff