Articles on: Developer

Domain Registrar Plugin Development Guide

A domain registrar plugin allows Clientexec to automatically register, renew and manage domain names.

We have created a sample domain registrar module that should be used as a starting point: https://github.com/clientexec/sample-registrar

Naming Convention



The name of the plugin directory MUST be all lower case, and alphanumeric, such as sample.

The name of the plugin file, and the plugin class MUST start with Plugin, followed by the name of the directory with ONLY the first letter capitalized, such as PluginSample

Features



Each domain registrar plugin can define certain features to be available or not.

nameSuggest - If the domain registrar supports name suggestions.
importDomains - If this plugin can import already registered domains from the domain registrar.
importPrices - If this plugin can import TLDs and prices from the domain registrar.

public $features = [
    'nameSuggest' => true,
    'importDomains' => true,
    'importPrices' => true,
];


Configuration



Each domain registrar plugin must have a getVariables() function which will define certain options. The function must return an array of values.

public function getVariables()
{
    $variables = [
        'Name' => [
            'type' => 'hidden',
            'description' => 'Used by CE to show plugin',
            'value' => 'Sample'
        ],
        'Description' => [
            'type' => 'hidden',
            'description' => 'Description viewable by admin in server settings',
            'value' => 'Sample Server Plugin'
        ],
        'Text Field' => [
            'type' => 'text',
            'description' => 'Text Field Description',
            'value' => 'Default Value',
        ],
        'Encrypted Text Field' => [
            'type' => 'text',
            'description' => 'Encrypted Text Field Description',
            'value' => '',
            'encryptable' => true
        ],
        'Password Text Field' => [
            'type' => 'password',
            'description' => 'Encrypted Password Field Description',
            'value' => '',
            'encryptable' => true
        ],
        'Text Area' => [
            'type' => 'textarea',
            'description' => 'Text Area Description',
            'value' => 'Default Value',
        ],
        'Yes / No' => [
            'type' => 'yesno',
            'description' => 'Yes / No Description',
            'value' => '1',
        ],
        'Actions' => [
            'type' => 'hidden',
            'description' => 'Current actions that are active for this plugin (when a domain isn\'t registered)',
            'value'=>'Register'
        ],
        'Registered Actions' => [
            'type' => 'hidden',
            'description' => 'Current actions that are active for this plugin (when a domain is registered)',
            'value'=>'Renew (Renew Domain),DomainTransferWithPopup (Initiate Transfer),SendTransferKey (Send Auth Info),Cancel'
        ],
        'Registered Actions For Customer' => [
            'type' => 'hidden',
            'description' => 'Current actions that are active for this plugin (when a domain is registered)',
            'value' => 'SendTransferKey (Send Auth Info)'
        ]
    ];

    return $variables;
}


Error Handling



Throwing a CE_Exception will display the error message to the client/admin.

Functions



The following is a list of minimal functions for a domain registrar plugin. Additional functions may be created, and assigned to the "Actions" (for admin) or "Registered Actions For Customer" (for client side) array.

getTLDsAndPrices



Called when importing TLDs and Prices from the domain registrar.

checkDomain



Called when checking if a domain is available for registration or not.

doDomainTransferWithPopup



Called when initiating a domain transfer from admin that requires an EPP Code.

doRegister



Called when registering a domain.

doRenew



Called when renewing a domain.

getTransferStatus



Called when checking the status of a transfer order.

getContactInformation



Called when getting the contact information of a domain.

setContactInformation



Called when updating/setting contact information of a domain.

getNameServers



Called when getting name servers of a domain.

setNameServers



Called when setting the name servers of a domain.

getGeneralInfo



Called to get general information on the domain, such as expiration date.

fetchDomains



Called when importing domains from the domain registrar.

disablePrivateRegistration



Called when disabling ID Protect.

setAutorenew



Called when updating auto renew.

getRegistrarLock



Called to get if the domain is locked or not.

doSetRegistrarLock



Called to update the lock status of a domain.

doSendTransferKey



Called to send the transfer key to the registrant.

getDNS



Called to get host/dns records of the domain.

setDNS



Called to update/set host records of the domain.

getEPPCode



Called to show the EPP code in the client and admin UI.

Updated on: 27/02/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!