@Kian Thanks for your reply. I am receiving this product/service from this API and submitting it via the api you mentioned "AddOrder". It creates an order at the WHMCS, but the configurable options are missing as I have pointed out in the above attachment. Below is the code I am using.
if ($input['package'] == 45) {
$product = $packages['license'];
$config_options = [
base64_encode(serialize([
$product['options']['physical_servers']['id'] => (int)$input['agents']
]))
];
$product_options = $product['options']['license_key']['options'];
}
$selected_package = null;
foreach ($product_options as $record) {
if ($input['package'] == $record['id']) {
$selected_package = $record;
break;
}
}
// Package price
$package_price = 0;
if ($input['term'] == 'monthly') {
$package_price = $selected_package['pricing']['monthly'];
} else {
$package_price = $selected_package['pricing']['annually'];
}
// Setup price
$setup_price = 0;
if ($input['setup'] == 1) {
$setup_price = 24.95;
}
// Addons prices
$tier_price = 0;
if ($input['package'] == 45) {
$tiers = $packages['license']['options']['physical_server_tier']['options'];
if ($input['term'] == 'monthly') {
$tier_price = $tiers[0]['pricing']['monthly'] * $input['agents'];
} else {
$tier_price = $tiers[0]['pricing']['annually'] * $input['agents'];
}
}
$total_price = $package_price + $setup_price + $tier_price;
$response = $this->client->request('POST', $this->api_url, [
'form_params' => [
'action' => $this->commands['place_order'],
'username' => $this->api_identifier,
'password' => $this->api_secret,
'clientid' => $client_id,
'pid' => $product['id'],
'billingcycle' => $input['term'],
'configoptions' => $config_options,
'paymentmethod' => 'paypalbilling',
'clientip' => $_SERVER['REMOTE_ADDR'],
'priceoverride' => round(floatval($total_price), 2),
'responsetype' => 'json',
]
]);
$result = json_decode($response->getBody());