1
jfmoore
Interface Xoops sign-up with billing software
  • 2007/10/25 3:43

  • jfmoore

  • Quite a regular

  • Posts: 360

  • Since: 2004/6/6 5


For billing software, I use WHM Complete solutions which I like a lot. WHMCS provides an API so that external scripts can interface with it. When someone signs up, I would like for the XOOPS sign-up form to interface with WHMCS so as to create a billing account with the same username, password, and other info and was wondering how hard this would be to do? Any thoughts would be appreciated.

Here's the instructions for connecting with the API:

Communicating with the WHMCS API is very simple.  
The below code is a PHP code example of how it can be done.

$url "http://www.yourdomain.com/whmcs/includes/api.php"# URL to WHMCS API file goes here
$username "Admin"# Admin username goes here
$password "demo"# Admin password goes here

$postfields["username"] = $username;
$postfields["password"] = md5($password);
$postfields["action"] = "addinvoicepayment";
$postfields["invoiceid"] = "1";
$postfields["transid"] = "TEST";
$postfields["gateway"] = "mailin";

$ch curl_init();
curl_setopt($chCURLOPT_URL$url);
curl_setopt($chCURLOPT_POST1);
curl_setopt($chCURLOPT_TIMEOUT10);
curl_setopt($chCURLOPT_RETURNTRANSFER1);
curl_setopt($chCURLOPT_POSTFIELDS$postfields);
$data curl_exec($ch);
curl_close($ch);

$data explode(";",$data);
foreach (
$data AS $temp) {
 
$temp explode("=",$temp);
 
$results[$temp[0]] = $temp[1];
}

if (
$result["result"]=="success") {
 
# Result was OK!
} else {
 
# An error occured
 
echo "The following error occured: ".$result["message"];
}

?>


And here's the new client command:

This command is used to add a new client to your WHMCS system.

Attributes

firstname
lastname
companyname 
optional
email
address1
address2 
optional
city
state
postcode
country 
two letter ISO country code
phonenumber
password2 
password for the new user account

Example Command

$postfields
["action"] = "adduser";
$postfields["firstname"] = "Test";
$postfields["lastname"] = "User";
$postfields["companyname"] = "WHMCS";
$postfields["email"] = "demo@whmcs.com";
$postfields["address1"] = "123 Demo Street";
$postfields["city"] = "Demo";
$postfields["state"] = "Florida";
$postfields["postcode"] = "AB123";
$postfields["country"] = "US";
$postfields["phonenumber"] = "123456789";
$postfields["password2"] = "demo";

Returned Variables

clientid 
the id of the new user
...

Login

Who's Online

365 user(s) are online (270 user(s) are browsing Support Forums)


Members: 0


Guests: 365


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits