Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Getting Started

hitmanpt edited this page Feb 8, 2017 · 6 revisions

Installation

Using NuGet

NuGet Packet Manager Console on VisualStudio Install-Package WHMCS_API
All dependencies will be installed

Using Release Files

  1. Just download the WHMCS API.dll
    Check the releases on the project page to get the latest version
  2. Add it as a reference to your project
  3. Install the Json.NET from Newtonsoft
    Option 1
    Using the NuGet Packet Manager Console on VisualStudio Install-Package Newtonsoft.Json -Version 9.0.1
    Option 2
    Downloading from our releases page

WHMCS Related Note

If you do not have an WHMCS ACCESSKEY this is what you need to do

  1. Go to your whmcs root folder
  2. Find and open the file configuration.php
  3. Add the line $api_access_key = "abc123";

The AccessKey must be a strong string so I recommend using an Password Generator

Basic Usage

The basic usage is pretty straight foward here is an example of an asp.net app

using System.Web.Mvc;
using WHMCS_API;

namespace MVCDemo.Controllers
{
    public class HomeController : Controller
    {
        private readonly string username = "WHMCS_API_USERNAME";
        private readonly string password = "WHMCS_API_PASSWORD";
        private readonly string accessKey = "WHMCS_API_ACCESSKEY";
        private readonly string whmcsUrl = "WHMCS_USERFRONTEND_URL"; //Example: http://example.com/whmcs

        public ActionResult Index()
        {
            API whmcs = new API(username, password, accessKey, whmcsUrl);
            int ClientID = whmcs.ValidateLogin("SomeUserEmail", "PlainTextPassword").ClientID;
            ViewBag.ClientDetails = whmcs.GetClientsDetails(ClientID);
            ViewBag.Transactions = whmcs.GetTransactions(ClientID: ClientID);
            return View();
        }
}

You depending on the function you might have optional and/or required parameters
When the parameters are optional you can skip to the by using ParamName: ParamValue

Donate