07-26-2023, 11:18 PM
I'm adding a new order using WHMCS local API. Everything works fine except domainrenewals fields.
if(!empty($_POST['renewalids']))
{
$postarray = array();
$postarray['action'] = 'addorder';
$postarray['clientid'] = \Yii::$app->user->identity->id;
$postarray["paymentmethod"] = "paypal";
foreach($_POST['renewalids'] as $key=>$id)
{
$priceselected = $_POST['renewalperiod'][$key];
$price = explode('_',$priceselected);
$postarray["domainrenewals[".$id."]"] = $price[0]; #renew for 1 year
/*$postarray["domainrenewals"][$id] = $price[0];*/
}
$orderDetails = WHMCSAPI::callApi($postarray);
its giving me error "No items added to cart so order cannot proceed".
Do you have any suggestion?
if(!empty($_POST['renewalids']))
{
$postarray = array();
$postarray['action'] = 'addorder';
$postarray['clientid'] = \Yii::$app->user->identity->id;
$postarray["paymentmethod"] = "paypal";
foreach($_POST['renewalids'] as $key=>$id)
{
$priceselected = $_POST['renewalperiod'][$key];
$price = explode('_',$priceselected);
$postarray["domainrenewals[".$id."]"] = $price[0]; #renew for 1 year
/*$postarray["domainrenewals"][$id] = $price[0];*/
}
$orderDetails = WHMCSAPI::callApi($postarray);
its giving me error "No items added to cart so order cannot proceed".
Do you have any suggestion?