Hello,
I seem to have encountered an issue with the AddOrder command when using the API. After creating a client, I try to use the function to add an order with a product, but for some reason the product is never added and a blank order is created. Consequently, no invoice is generated.
The code I am using below:
$postfields["action"] = "addorder";
$postfields["clientid"] = "56";
$postfields["pid"] = "1";
$postfields["domain"] = "mytestdomain.com";
$postfields["billingcycle"] = "monthly";
$postfields["paymentmethod"] = "authorize";
$postfields["username"] = $whmcsuser;
$postfields["password"] = md5($whmcspass);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
When I do a var_dump, I get the following:
result=success;orderid=[new order id];invoiceid=
I tried changing the postfiel name to 'product' and 'productid' and neither worked.
Please advice, and thanks in advance!