RegisterDomain
%Plugin_Name%_RegisterDomain
Purpose
Use this function to request domain registration.
Input Parameters
configarray: an array of parameters defined during the plugin configuration.sld: a second-level domain name.tld: a top-level domain name.regperiod: a domain registration period.nsX (ns1, ns2, ...): an array of domain's name server, separated by comma.Owner Info: an associative array containing the following data:firstnamemiddlenamelastnamebirthdaycompanynameemailcountrypostcodecitystatestatenameaddress1address2phonenumberfaxphonenumberseparated: an associative array containing the following data:countryCodeareaCodenumberext
faxseparated: an associative array containing the following data:countryCodeareaCodenumberext
Admin info: same fields as for owner info, but parameters names are prefixed with 'admin', for example:adminfirstnameBilling info: same fields as for owner info, but parameters names are prefixed with 'billing', for example:billingfirstnameTechnical info: same fields as for owner info, but parameters names are prefixed with 'tech', for example:techfirstname.additionalfields: supplementary data for further domain processing.
Note:
1. If the Local Presence service is being enabled for a domain, CloudBlue Commerce passes the LOCAL_PRESENCE parameter with the value 1 in the additionalfields parameter of the method request.
2. To retrieve custom attributes required for domain registration, refer to this KB article.
Return Parameters
- associative array of type
'key' => 'value'(optional): in which only strings allowed for bothkeyandvalue. lockenabled(optional): a string with valuelockedif the registrar lock for the domain is enabled. Omit this parameter, or pass any other value if the registrar lock is disabled.
Mandatory
Yes
Example
function Example_RegisterDomain($params)
{
// Configuration data specified in Example_GetConfigArray()
$apiUsername = $params["Username"];
$apiKey = $params["Key"];
$apiMode = $params["Test Mode"];
$tld = $params["tld"];
$sld = $params["sld"];
$domainName = "$sld.$tld";
$period = $params["regperiod"];
$nameservers = array();
for ($i = 1; $i <= 5; $i++) {
if (isset($params['ns' . $i])) {
$nameservers[] = $params['ns' . $i];
}
}
// Additional domain fields returned by Example_ValidateAdditionalFields()
$extraFields = $params["additionalfields"];
$owner = array();
$billing = array();
$admin = array();
$tech = array();
$owner["first_name"] = $params["firstname"];
$owner["last_name"] = $params["lastname"];
$owner["org_name"] = $params["company"];
$owner["phone"] = $params["phonenumberseparated"];
$owner["fax"] = $params["faxseparated"];
$owner["email"] = $params["email"];
$owner["postal_code"] = $params["postcode"];
$owner["country"] = $params["country"];
$owner["state"] = $params["state"];
$owner["city"] = $params["city"];
$owner["address1"] = $params["address1"];
$owner["address2"] = $params["address2"];
$billing["first_name"] = $params["billingfirstname"];
// The rest of Billing contact fields are prefixed with "billing"
//$billing["last_name"] = $params["billinglastname"];
$admin["first_name"] = $params["adminfirstname"];
// The rest of Admin contact fields are prefixed with "admin"
//$admin["last_name"] = $params["adminlastname"];
$tech["first_name"] = $params["techfirstname"];
// The rest of Technical contact fields are prefixed with "tech"
//$tech["last_name"] = $params["techlastname"];
try {
// Make API calls here
} catch(Exception $e) {
// In case of errors
return array(
"error" => $e->getMessage(),
);
}
// It's possible to return additional data to be stored for this domain name
return array(
"additionalfields" => array(
"OrderID" => $response["orderid"],
),
"lockenabled" => "locked"
);
}