Jump to content

namoos

Member
  • Posts

    3
  • Joined

  • Last visited

About namoos

namoos's Achievements

Junior Member

Junior Member (1/3)

0

Reputation

  1. @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());
  2. Hi, I am implementing the AddOrder API, a bit confused by the configoptions. Actually I am unable to make a proper request. In the order there are configurable options like physical servers and tiers etc. In the below product I need 2 configurable options, "physical_server_tier" and "physical_servers", according to docs the code should look like this. "configoptions" => [base64_encode(serialize([ '12' => 2 // quantity of the physical servers '11' => 27 ]))], but this is not working. Any help would be much appreciated. array:3 [▼ "id" => 8 "name" => "R1Soft License Key" "options" => array:7 [▼ "physical_tier_lock" => array:3 [▶] "physical_server_tier" => array:3 [▼ "id" => 11 "name" => "Physical Server Tier" "options" => array:8 [▼ 0 => array:4 [▼ "id" => 27 "name" => "tier-0" "currency" => "USD" "pricing" => array:3 [▶] ] 1 => array:4 [▶] 2 => array:4 [▶] 3 => array:4 [▶] 4 => array:4 [▶] 5 => array:4 [▶] 6 => array:4 [▶] 7 => array:4 [▶] ] ] "physical_servers" => array:3 [▼ "id" => 12 "name" => "Physical Servers" "options" => array:1 [▼ 0 => array:4 [▼ "id" => 35 "name" => "Physical Servers" "currency" => "USD" "pricing" => array:3 [▶] ] ] ] "virtual_tier_lock" => array:3 [▶] "virtual_machine_tier" => array:3 [▶] "virtual_machines" => array:3 [▶] "license_key" => array:3 [▶] ] ]
  3. Hi, I am using APIs, for which the public IP should be added to the whitelist filter in whmcs. I have added my local machine public IP, but strange thing happened, it stopped working. Now whatever connection I use for my local machine and whitelist the IP, I still receive the same error. And the same code works on the production server. The error message I received is: Authentication Failed 403 Forbidden Any help would be much appreciated.
  4. Welcome to WHMCS.Community namoos! We're glad you're here please take some time to familiarise yourself with the Community Rules & Guidelines and take a moment to introduce yourself to other WHMCS.Community members in the Introduce Yourself Board.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated