medineshkatwal Posted May 3, 2018 Share Posted May 3, 2018 Hello, Why addorder configoptions not working. i have also done base64encoding in configoption like this. curl -X POST \ https://myhost.com/includes/api.php \ -H 'Content-Type: application/json' \ -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \ -F username=username \ -F password=password\ -F responsetype=json \ -F action=AddOrder \ -F clientid=293 \ -F paymentmethod=tco \ -F 'pid[0]=1' \ -F 'billingcycle[0]=semiannually' \ -F 'configoptions=[YToxOntpOjI7aToyO30=, YToxOntpOjEwO2k6MjE7fQ==]' \ -F promooverride=false \ -F currency=INR Response is: { "result": "success", "orderid": 778, "productids": "949", "addonids": "", "domainids": "", "invoiceid": 824 } When i look in whmcs i can see that there is no changes in configoptions. It doesn't throw error if my configoptions is wrong. Evertime the first options of configoptions are selected as you can see in attachment. When i look in whmcs add order documentation: https://developers.whmcs.com/api-reference/addorder/ configoptions is send like this: array(base64_encode(serialize(array("2" => 2))), base64_encode(serialize(array("10" => 21)))); => ouput is [YToxOntpOjI7aToyO30=, YToxOntpOjEwO2k6MjE7fQ==] Please help me i am stuck into this problem for long time. Thank you. 0 Quote Link to comment Share on other sites More sharing options...
medineshkatwal Posted May 6, 2018 Author Share Posted May 6, 2018 Any update 0 Quote Link to comment Share on other sites More sharing options...
vidyamantra Posted March 27, 2020 Share Posted March 27, 2020 +1 Same issue. Can't make configoptions work. I assumed that syntax is array(base64_encode(serialize(array(CONFIG_OPTION_ID => CONFIG_OPTION_SUB_ID)))); Am I missing something? 0 Quote Link to comment Share on other sites More sharing options...
Abdullah Posted March 29, 2020 Share Posted March 29, 2020 You have passed like this : configoptions is send like this: array(base64_encode(serialize(array("2" => 2))), base64_encode(serialize(array("10" => 21)))); => ouput is [YToxOntpOjI7aToyO30=, YToxOntpOjEwO2k6MjE7fQ==] But I have passed like this and its worked for me : // Geting IDs for config options$operating_system = ["2" => 2];$cpanel_cloud_license = ["10" => 21]; // Config Options Array Merge for multiple config options$configoptions_array_merge = $operating_system + $cpanel_cloud_license; // Config Options Array Formatted for WHMCS API$configoptions_array[] = base64_encode(serialize($configoptions_array_merge)); // Sending to API'configoptions' => isset($configoptions_array) ? $configoptions_array : '', MUST Remember : Your Output is : [YToxOntpOjI7aToyO30=, YToxOntpOjEwO2k6MjE7fQ==]But Correct Output will be only one always, doesn't matter how many arrays you have passed.Correct Output will be : [YToxOntpOjI7aToyO30=] 0 Quote Link to comment Share on other sites More sharing options...
heapmaster Posted August 14, 2021 Share Posted August 14, 2021 On 3/28/2020 at 9:21 PM, Abdullah said: You have passed like this : configoptions is send like this: array(base64_encode(serialize(array("2" => 2))), base64_encode(serialize(array("10" => 21)))); => ouput is [YToxOntpOjI7aToyO30=, YToxOntpOjEwO2k6MjE7fQ==] But I have passed like this and its worked for me : // Geting IDs for config options$operating_system = ["2" => 2];$cpanel_cloud_license = ["10" => 21]; // Config Options Array Merge for multiple config options$configoptions_array_merge = $operating_system + $cpanel_cloud_license; // Config Options Array Formatted for WHMCS API$configoptions_array[] = base64_encode(serialize($configoptions_array_merge)); // Sending to API'configoptions' => isset($configoptions_array) ? $configoptions_array : '', MUST Remember : Your Output is : [YToxOntpOjI7aToyO30=, YToxOntpOjEwO2k6MjE7fQ==]But Correct Output will be only one always, doesn't matter how many arrays you have passed.Correct Output will be : [YToxOntpOjI7aToyO30=] This doenst work for quantity selection like a slider or text box 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.