2017-05-24 63 views
3

我正在使用WHMCS本地API添加新訂單。除了自定義字段,一切正常。WHMCS本地API AddOrder問題

$command = 'AddOrder'; 
$postData = array(
    'clientid' => $client_id, 
    'pid' => array($product_id), 
    'billingcycle' => array('monthly'), 
    'customfields' => array(base64_encode(serialize(array(1 => $site_id)))), 
    'paymentmethod' => 'stripe', 
); 
return localAPI($command, $postData); 

我的自定義字段ID是53,但由於教程的原因,我將該鍵設置爲1。我也試過53作爲關鍵array(base64_encode(serialize(array(53 => $site_id))))但沒有任何改變。

你有什麼建議嗎?

回答

0

試試這個:

$command = 'AddOrder'; 
$postData = array(
'clientid' => $client_id, 
'pid' => array($product_id), 
'billingcycle' => array('monthly'), 
'customfields[0]' => array(base64_encode(serialize(array(1 =>  $site_id)))),//changes here 
'paymentmethod' => 'stripe', 
); 
return localAPI($command, $postData);ode here