Announcement

Collapse
No announcement yet.

Need Help for API Order.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need Help for API Order.

    I am trying to make a simple hosting order form and I go key by key from the documents. all was working fine until i reached the "domains" key. although it says optional it says "invalid domains data' if I do try to put a domain and 'type' it says I must choose between 'register','transfer', or 'existing' and even after I choose either.. I still get the same answer.. here is that part of the PHP code. and I'll share the entire code so far if needed.

    $data = Array(
    "section"=>"order",
    "command"=>"create",
    "firstname"=>$first_name,
    "lastname"=>$last_name,
    "email"=>$email,
    "address1"=>$address1,
    "city"=>$city,
    "zip"=>$zip,
    "ip"=>$_SERVER['REMOTE_ADDR'],
    "country"=>$country,
    "phone"=>$phone,

    "plan"=>65209,
    "period"=>12,
    "payment_method"=>"Wallet",
    "return_url"=>"https://www.lcsitmediahosting.com/",
    "price_type"=>"wholesale",
    "domains"=>Array("type"=>"host")
    );

  • #2
    Hello,

    Please provide us with the URL where your order form is configured at so we can test this on our end.

    Looking forward hearing from you.

    Best Regards,
    Nick Green,
    Technical Support Department

    Comment


    • #3
      Hi Nick, thanks for the reply. I am currently just testing as I said going key by key and filling as it asks.. the test php file is this one :
      https://locker.lcsitmedia.com/test.php

      and here is the entire code
      PHP Code:
      function commands_get($url,$user,$pass,$data_array$debug false) {
      $file $url;
      $username $user;
      $password $pass;


      $file .= "?auth_username=$username&auth_password=$password& test_mode=1&return_type=serialization&".http_build _query($data_array);
      $tester "https://api.duoservers.com/?auth_username=lcsitmedia&auth_password=tslk2114&s ection=products&command=get_plans&rp_product_id=65 209&test_mode=1&reseller=1&return_type=serialization";
      if (
      $debug) return $file;
      if(!(
      $data = @file_get_contents($file))) {
      return 
      false;
      }

      $result = @unserialize($data);
      if (!
      is_array($result)) return false;

      return 
      $result;
      }

      echo 
      "This is a test<br>";
      $API_URL "https://api.duoservers.com";
      $user "***";
      $pass "**";

      $command_test $API_URL."auth_username=".$user."&auth_password="$pass."&section=products&command=getplans&test_mode=1";
      $first_name "***";
      $last_name "**";
      $email "***";
      $address1 "***";
      $city "***";
      $country "US";
      $phone "***";
      $zip 9****;

      $data = Array(
      "section"=>"order",
      "command"=>"create",
      "firstname"=>$first_name,
      "lastname"=>$last_name,
      "email"=>$email,
      "address1"=>$address1,
      "city"=>$city,
      "zip"=>$zip,
      "ip"=>$_SERVER['REMOTE_ADDR'],
      "country"=>$country,
      "phone"=>$phone,

      "plan"=>65209,
      "period"=>12,
      "payment_method"=>"Wallet",
      "return_url"=>"https://www.lcsitmediahosting.com/",
      "price_type"=>"wholesale",
      "domains"=>Array("type"=>"host")
      );
      $result commands_get($API_URL,$user,$pass,$data);
      foreach(
      $result[1] as $val){
      print_r($val);
      print_r("<br>");

      Last edited by sberniz; 10-05-2021, 04:17 PM. Reason: Adding Code

      Comment


      • #4
        Hello,

        We have received an update. It appears the trouble was caused by the domains array:

        "domains"=>Array("type"=>"host")

        The correct way is to have each domain name configured with a separate sub-array:

        "domains"=>Array(
        "domain.com" => array(
        "type" => "host", // can be register/transfer/host
        "domain" => "domain.com",
        )


        Our developers have already applied this change to the test script you have provided and producing the expected results.

        Let us know if there is anything else we can be of assistance with.

        Best Regards,
        Nick Green,
        Technical Support Department.

        Comment


        • #5
          Thank You Nick. Quick question however, if it says that the 'domains' is optional. why does it complain when I do not put it ?. I am doing this for third party marketing and All i want them is to create the hosting account and then create domain once they are inside the control panel.

          Comment


          • #6
            Hello,

            I have checked again with our developers and they have confirmed using 'domains' is indeed optional. Could you please clarify what exactly do you mean by "why does it complain when I do not put it" and what is the actual error noticed on your end?

            Looking forward hearing from you.

            Comment


            • #7
              Sure, If I do not put the 'domains' variable. it comes with error_code: 9 and it says :
              Invalid domains data provided. If it is optional I'm not sure why it asks me to put it.

              Comment


              • #8
                One More thing. I just catch when in test mode I did try create account and although username is required.. at least in test mode. it did not ask me for it. Im running key by key so I will update accordingly.

                Comment


                • #9
                  and this is just for clarifying on the documentation it says that i should get a "method" response and 'parameters' but all i get is these options
                  error_code => 0
                  redirect => 1
                  redirect_url => https://us.cloudlogin.co
                  execution_time => 0.171 s
                  db_time => 0.112 s
                  uniq_id => 2342323
                  ttl => 0
                  that's an example on unique id but.. does it mean that by sending the unique id everythign will work? it also does not specify method for get/post.

                  Comment


                  • #10
                    Hello,

                    We have investigated this and noticed there is a trouble. Our developers will have this resolved as soon as possible and we will write back once this is fixed. In the meantime as a workaround you will only need to send a currency with the API calls:

                    currency=USD

                    Comment


                    • #11
                      I just noticed that although "currency" says 'required' it did not ask me for it either. i just added it.. quick question since the api does not specify.. when I get an 'ok' message like above.. how do i 'redirect' so customer can create password/pay for it?.. although i am planijng to use 'wallet' as payment method. I want the api to be functional before using my wallet.

                      Comment


                      • #12
                        Hi Nick, any news on the API? I received an error 0 with redirect parameters but I think the parameters are incomplete. Please let me know. Thanks

                        Comment


                        • #13
                          I got it working with the multiple commands query letting everyone know there are issues with the 'single command' query on the API

                          Comment


                          • #14
                            Hey sberniz:

                            Were you able to get a finished product for your API order form? What documentation did you use to know what API's to use and how to set it up?

                            Thank you.

                            Comment


                            • #15
                              Yes, I was able to finish it. I used the one on my reseller panel api docs. but I had to guess why it wasn't. working. turns out there are issues with the single command query. I had to use the multiple commands form.. although I only needed one command. idk how many sections/command have the issue but for me was the order/create since is the only one i used.

                              Comment

                              Working...
                              X