Skip to content

Creating a Registrar Integration

Registrar adapters let FOSSBilling communicate with domain registrars to register, transfer, and manage domains on behalf of your customers.

Place your adapter in:

src/library/Registrar/Adapter/
└── YourRegistrar.php

Your class must extend Registrar_AdapterAbstract and implement its required methods.

Check the Registrar_AdapterAbstract class for the full list of methods to implement. Common ones include:

MethodPurpose
isAvailable()Check domain availability
register()Register a new domain
transfer()Transfer a domain
renew()Renew a domain
getInfo()Get domain details
modifyNs()Update nameservers
modifyContact()Update contact information
<?php
class Registrar_Adapter_YourRegistrar extends Registrar_AdapterAbstract
{
public function __construct($options)
{
parent::__construct($options);
if (!isset($this->config['api_key'])) {
throw new Registrar_Exception('API key is required');
}
}
public static function getConfig(): array
{
return [
'label' => 'YourRegistrar',
'form' => [
'api_key' => ['text', ['label' => 'API Key']],
'api_secret' => ['password', ['label' => 'API Secret']],
],
];
}
public function isAvailable($domain): bool
{
$response = $this->apiRequest('check', ['domain' => $domain]);
return $response['available'] ?? false;
}
public function register($domain, array $contact): bool
{
$params = [
'domain' => $domain,
'period' => $this->getPeriod(),
'contacts' => $this->normalizeContact($contact),
];
$response = $this->apiRequest('register', $params);
return $response['success'] ?? false;
}
private function apiRequest($action, array $params = []): array
{
$ch = curl_init($this->config['api_url'] . '/' . $action);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $this->config['api_key'],
'Content-Type: application/json',
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
}
  1. Create a test domain product in FOSSBilling
  2. Configure your registrar adapter in System → Domain registration
  3. Test domain availability checks
  4. Test registration (if possible with registrar's test environment)
  5. Verify contact information syncing

Join our Discord if you need assistance with your registrar integration.