WHMCS-VIMEXX

Why this post?

I ran into problems while automating domain registration using WHMCS and my registrar VIMEXX. VIMEXX does provide a registrar module but it does not work out of the box with my version of WHMCS. I was able to get it to work and thought it would a good idea to share my experience along with a updated version of the module.

About WHMCS

WHMCS is an all-in-one client management, billing & support solution for online businesses. Handling everything from signup to termination, WHMCS is a powerful automation & support tool.

About the problem

The module is fairly straightforward to install and configure but in its current form is unable to communicate successfully with the VIMEXX API as any attempt results in the following error: “api.invalid_version”. The module log shows the data being sent and the response:

Array
(
    [requesttype] => POST
    [url] => https://api.vimexx.nl/apitest/v1/whmcs/domain/register
    [postdata] => Array
        (
            [body] => Array
                (
                    [sld] => example
                    [tld] => nl
                )

            [version] => 8.5.1-release.1
        )

    [result] => {"message":"api.invalid_version","result":false,"data":[]}
    [httpcode] => 200
)

From the logs we conclude that WHMCS version “8.5.1-release.1” is not supported by VIMEXX at this moment and we will have to find a version that is. According to the documentation provided the last supported version at the moment is: “8.4.0-release.1”. So changing the VersionWhmcs parameter in the registrar module would solve our problem right? Sadly, it seems there is no such thing as a free lunch as the module ignores our change and uses the previous version resulting in the same error. At this point it seems there is a problem with the module itself so the next step is to look at the code.

Our failing code resides in “vimexx.php” and can be found below:

/**
 * Register a new domain
 *
 * @param $params
 * @return array
 */
function vimexx_RegisterDomain($params)
{
    $clientId   = $params['ClientID'];
    $clientKey  = $params['ClientKey'];
    $username   = $params['Username'];
    $password   = $params['Password'];
    $apiUrl     = $params['ApiUrl'];
    $endpoint   = $params['Site-version'];
    $testmode   = $params['TestMode'];
    $sld        = $params['sld'];
    $tld        = $params['tld'];

    $vimexx     = new Vimexx_API();
    $vimexx->setApi_login($clientId, $clientKey, $username, $password, $apiUrl, $endpoint);
    $vimexx->setApi_testmodus($testmode);

    $response = $vimexx->request('POST', '/whmcs/domain/register', [
        'sld' => $sld,
        'tld' => $tld
    ], $params['whmcsVersion']);

    if(!$response['result']) {
        $message = $response['message'];

        if (is_array($response['message'])) {
            $message = implode("\r\n", $response['message']);
        }

        return array('error' => $message);
    } else {
        return array(
            'success' => true,
        );
    }
}

Analysing this piece of code shows that it first declares some variables that in turn get their data from an array called “params”. The version number gets used on line 115 but returns “8.5.1-release.1” despite setting it to “8.4.0-release.1” in the module config indicating that something is not working as expected. Next up is the code that defines the “params” array:

/**
 * Set vimexx module config settings
 *
 * @return array
 */
function vimexx_getConfigArray($params)
{
    return array(
        'ClientID' => array(
            'Type' => 'text',
            'Size' => '25',
            'Default' => '',
            'Description' => 'Enter your client ID',
        ),
        'ClientKey' => array(
            'Type' => 'text',
            'Size' => '100',
            'Default' => '',
            'Description' => 'Enter your key',
        ),
        'Username' => array(
            'Type' => 'text',
            'Size' => '100',
            'Default' => '',
            'Description' => 'Enter your username',
        ),
        'Password' => array(
            'Type' => 'password',
            'Size' => '100',
            'Default' => '',
            'Description' => 'Enter your password ',
        ),
        'ApiUrl' => array(
            'Type' => 'text',
            'Size' => '100',
            'Default' => '',
            'Description' => 'API URL',
        ),
        'Site-version' => array(
            'Type' => 'dropdown',
            'Options' => array(
                '.nl' => 'NL',
            ),
            'Description' => 'Choose which Vimexx API you want to connect to',
        ),
        'TestMode' => array(
            'Type' => 'dropdown',
            'Options' => array(
                'true' => 'On',
                'false' => 'Off',
            ),
            'Description' => 'Choose one',
        ),
        'VersionWhmcs' => array(
            'Type' => 'text',
            'Size' => '100',
            'Default' => $params['whmcsVersion'],
            'Description' => '<b>NIET AANPASSEN!</b>',
        ),
    );
}

Of interest here is the last part of the array concerning “VersionWhmcs”. As shown the default value is “$params[‘whmcsVersion’]” or “8.5.1-release.1” which is expected and also immediately explains why our input is ignored. Examining the domain register code from before shows that it does not take the version from the module configuration but from somewhere else.

    $response = $vimexx->request('POST', '/whmcs/domain/transfer', [
        'sld'   => $sld,
        'tld'   => $tld,
        'token' => $token
    ], $params['whmcsVersion']);

Changing “$params[‘whmcsVersion’]” to “$params[‘VersionWhmcs’]” will ensure that the version configured in the module is used from now on.

And that is it! An updated version of the VIMEXX module can be found here: https://github.com/tomvanveen/WHMCS-VIMEXX

References:

12 thoughts on “WHMCS-VIMEXX”

  1. Beste Tom,

    Dank voor de heldere uitleg en de verbeterde module. Tijdens het testen loop ik tegen het feit aan dat het verhuizen van een domein, van extern naar mijn WHMCS module (met Vde Vimexx whmcs module) een error oplevert. Heb jij een idee voor een fix?

  2. Ja, ik kan in principe alles, een domein reserveren etc lukt allemaal in WHMCS via Vimexx. Totdat ik een domein wil verhuizen naar mijn WHMCS, dan krijg ik deze melding.

  3. Helaas, bij een domein dat nu bij TransIP staat wat via de WHMCS naar Vimexx zou moeten worden verhuist krijg ik in de backend van WHMCS deze melding: Registrar fout Gebruiker niet gevonden.

    Als ik bij register opdrachten de knop verhuizen gebruik om de verhuizing te ‘forceren’ krijg ik de volgende melding: Fout opgetreden domain.domainnotfound.

    Mocht je tijd hebben, misschien even via Teams o.i.d. verder sparren over het probleem?

    1. Niet schrikken maar ik heb je test domein even verhuisd naar mijn account. Bedacht me dat iedereen nu je domein kon verhuizen met dat token. Laat even weten waar ik een nieuwe verhuistoken naar toe kan sturen dan verhuizen we hem weer terug :).

    2. Vanochtend zelf ook even getest en krijg geen foutmeldingen. Ik verwacht dat je authenticatie met Vimexx niet goed is waardoor hij geen connectie maakt en het domein niet kan vinden. Dit ook omdat de nameservers anders zijn in het Vimexx dashboard dan in WHMCS. Mocht het nou nog steeds niet lukken laat het weten dan kan ik wat tijd vrijmaken om je te helpen.

  4. Dag Tom,

    De afgelopen dagen ben ik even verder gaan zoeken en ik ben ondertussen overgestapt naar Openprovider. Vimexx kreeg ik niet aan de praat en dat hoeft voor mij nu ook even niet meer. Thx in elk geval voor je support!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.