kmm2908 Posted February 22, 2010 Share Posted February 22, 2010 I am having problems with my remote order form script. I am continuously getting this error message: array(1) { ["Invalid TLD/Registration Period Supplied for Domain Registration"]=> NULL } I have read the other posts on this error message and they all suggest checking product set up. We are able to process payments fine through the normal interface so there cannot be a problem here; it is only when we access the system through the api we get the problem. I am able to register a new customer but the domain and hosting 'add order' section is posing the problem. The relevant code follows: // add order details $postfields= array(); $postfields["username"] = $username; $postfields["password"] = md5($password); $postfields["action"] = "addorder"; $postfields["clientid"] = $clientid; $postfields["pid"] = $pid; $postfields["domain"] = $domain; $postfields["paymentmethod"] = $paybytxt; $postfields["billingcycle"] = $billingcycle; $postfields["domaintype"] = $domaintype; $query_string = ""; foreach ($postfields AS $k=>$v) { $query_string .= "$k=".urlencode($v)."&"; } // WHMCS invocation call $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string); $data = curl_exec($ch); curl_close($ch); $data = explode(";",$data); foreach ($data as $temp) { $temp = explode("=",$temp); $results2[$temp[0]] = $temp[1]; } var_dump($results2); I have had a remote form script working before for non-domain and hosting products, so I am assuming it must be to do with whatever variables I am passing into the api for the domain and/or hosting that is causing the problem. I have checked my script against others posted on the forum and I really cannot see anything to cause this error. Any help greatly appreciated. 0 Quote Link to comment Share on other sites More sharing options...
logicsurge Posted February 22, 2010 Share Posted February 22, 2010 You need to specify postfields["regperiod"] = NUMBEROFYEARSTOREGISTERDOMAIN; 0 Quote Link to comment Share on other sites More sharing options...
kmm2908 Posted February 23, 2010 Author Share Posted February 23, 2010 You need to specify postfields["regperiod"] = NUMBEROFYEARSTOREGISTERDOMAIN; Hi and thanks for reply logicsurge I have tried it both with and without regperiod code as you suggested and still get same error message. Any other suggestions? Is there a support department at WHMCS that can help with this as I cannot go forward until know what the error is before I can correct it. Very Frustrating! 0 Quote Link to comment Share on other sites More sharing options...
kmm2908 Posted February 23, 2010 Author Share Posted February 23, 2010 I have added a print out of variables I echoed to screen on the error being returned. I have a routine that checks that the customer details have been added successfully and it returns the clientid. Client account for Martin created Client ID: 12799 Billing Cycle: annually Reg Period: 1 Pay By: tco Domain: wedsssdrew.com Domain Type: Register array(1) { ["Invalid TLD/Registration Period Supplied for Domain Registration"]=> NULL } Latest Inv #: Hope this helps prompt further assistance. Thanks 0 Quote Link to comment Share on other sites More sharing options...
kmm2908 Posted February 24, 2010 Author Share Posted February 24, 2010 Does anyone know what throws up the error? ["Invalid TLD/Registration Period Supplied for Domain Registration"] AS in what is being checked by the API to throw that? 0 Quote Link to comment Share on other sites More sharing options...
jasonBV Posted February 24, 2010 Share Posted February 24, 2010 You should just need to pass the regperiod as mentioned above, can you post some snippets of your code, maybe it's not getting passed by chance? 0 Quote Link to comment Share on other sites More sharing options...
kmm2908 Posted February 24, 2010 Author Share Posted February 24, 2010 You should just need to pass the regperiod as mentioned above, can you post some snippets of your code, maybe it's not getting passed by chance? What other code can I post to help jason? The api call is above and the printout from the echoing of variables is above. // add order details $postfields= array(); $postfields["username"] = $username; $postfields["password"] = md5($password); $postfields["action"] = "addorder"; $postfields["clientid"] = $clientid; $postfields["pid"] = $pid; $postfields["domain"] = $domain; $postfields["paymentmethod"] = $paybytxt; $postfields["billingcycle"] = $billingcycle; $postfields["domaintype"] = $domaintype; $postfields["regperiod"] = $regperiod; $query_string = ""; foreach ($postfields AS $k=>$v) { $query_string .= "$k=".urlencode($v)."&"; } // WHMCS invocation call $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string); $data = curl_exec($ch); curl_close($ch); $data = explode(";",$data); foreach ($data as $temp) { $temp = explode("=",$temp); $results2[$temp[0]] = $temp[1]; } var_dump($results2); 0 Quote Link to comment Share on other sites More sharing options...
jasonBV Posted February 24, 2010 Share Posted February 24, 2010 Had the same error, everything looks right to me, not sure what to tell you. 0 Quote Link to comment Share on other sites More sharing options...
kmm2908 Posted February 25, 2010 Author Share Posted February 25, 2010 Had the same error, everything looks right to me, not sure what to tell you. Thanks for trying jason. I have Matt looking at it so I'll let everyone knows what pans out. 0 Quote Link to comment Share on other sites More sharing options...
KuJoe Posted February 25, 2010 Share Posted February 25, 2010 Can you provide the actual form code? Might be a problem in the form itself? That's the only thing I can think of since your code looks very close to mine. 0 Quote Link to comment Share on other sites More sharing options...
kmm2908 Posted February 25, 2010 Author Share Posted February 25, 2010 Can you provide the actual form code? Might be a problem in the form itself? That's the only thing I can think of since your code looks very close to mine. Hi KuJoe, thanks for reply. I've echoed out the form variables to the screen and the screen shot is above. I cannot see any errors myself. Matt is looking at it for me so I'll update if we find anything. Thanks again! 0 Quote Link to comment Share on other sites More sharing options...
WHMCS CEO Matt Posted February 27, 2010 WHMCS CEO Share Posted February 27, 2010 I can confirm I checked into this and verified the API AddOrder call is working correctly so it must be an error in the domain and regperiod variables being passed from your custom coding to result in an error. Matt 0 Quote Link to comment Share on other sites More sharing options...
kmm2908 Posted February 28, 2010 Author Share Posted February 28, 2010 Thanks Matt for looking. What could the error be? The regperiod variable passed is the integer 1. I have also passed it as text and neither have worked. The domain variable is a text variable containing the full domain and extension. I have used php to separate on the '.' to arrive at an extension of '.com'. Both of these variables plus the regperiod variable echo out to the screen just before passing to api call correctly. What could possibly be stopping this from working? The code I use registers the new client without a problem and the order details are written to tblorders, it just baulks at the domain/tld resulting in - ["Invalid TLD/Registration Period Supplied for Domain Registration"] There must be a simple explanation - any ideas? 0 Quote Link to comment Share on other sites More sharing options...
kmm2908 Posted March 1, 2010 Author Share Posted March 1, 2010 Ok problem resolved! The regperiod variable was being passed with a capital 1st letter - but not any longer! Thanks to Matt for all the patient help in resolving this. I still have one problem to resolve - the invoice is being created and then tagged as paid when it is not. Can anyone point me at which part of the api call affects this aspect? 0 Quote Link to comment Share on other sites More sharing options...
kmm2908 Posted March 1, 2010 Author Share Posted March 1, 2010 Nahh... last problem was just my mistake - forgot to set the price so a zero price was being registered as paid! 0 Quote Link to comment Share on other sites More sharing options...
24x7 Posted February 3, 2011 Share Posted February 3, 2011 I had same issue. My mistake I created all TLDS without the period (.com, .net) in the domain pricing section. Added all and the problem resolved. 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.