developer _WHM_CS Posted March 3, 2018 Share Posted March 3, 2018 Hello We need to have Upgrade option on configoption of a service through API According to the link belowhttps://developers.whmcs.com/api-reference/upgradeproduct/ here is our sample code: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://www.mydomain.com/includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'UpgradeProduct', // See https://developers.whmcs.com/api/authentication 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 'password' => 'SECRET_OR_HASHED_PASSWORD', 'serviceid' => '1', 'paymentmethod' => 'paypal', 'type' => 'configoptions', 'configoptions' => array(50 => 80, 30 => 81 ,40 => 23); 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); configoptions is an array The Numbers 30, 40, 50 are configoption ID and the Numbers 23, 81, 80 are new value Then return this : result":"success","configname1":"Slaves","originalvalue1":"0","newvalue1":"80 x Slaves","price1":"313,227,380 USD","configname2":"Mini Slaves","originalvalue2":"0","newvalue2":"81 x Mini Slaves","price2":"234,920,535 USD","configname3":"Micro Slaves","originalvalue3":"0","newvalue3":"23 x Micro Slaves","price3":"104,329,507 USD","subtotal":"652,477,422 USD","discount":"0 USD","total":"652,477,422 USD","id":"6491","orderid":6425,"order_number":"4918850114","invoiceid":"84001"} And Why hit new value to the options name ??? 80 * Salves !!! 81 * Mini Slave!! 23* Micro Slave!! Please help me Thanks you Link to comment Share on other sites More sharing options...
Recommended Posts