Building a Custom Registrar Integration
The Domain Seller addon uses an Integration Registry pattern. Each registrar is a PHP class that implements Domain_Selling_Capability and registers itself via the wu_domain_seller_register_capabilities action hook.
This guide shows how to wire in a custom registrar.
The interface
Your class must implement WP_Ultimo\Integrations\Capabilities\Domain_Selling_Capability and extend WP_Ultimo\Integrations\Base_Capability_Module.
Required methods:
namespace My\Plugin\Capabilities;
use WP_Ultimo\Integrations\Base_Capability_Module;
use WP_Ultimo\Integrations\Capabilities\Domain_Selling_Capability;
class My_Registrar_Selling extends Base_Capability_Module implements Domain_Selling_Capability {
// --- Required identity methods (from Base_Capability_Module) ---
public function get_capability_id(): string {
return 'domain-selling'; // always 'domain-selling'
}
public function get_title(): string {
return __('Domain Selling', 'my-plugin');
}
public function get_explainer_lines(): array {
return [
'will' => [__('Enable domain registration via My Registrar.', 'my-plugin')],
'will_not' => [],
];
}
// --- Core required methods (from Domain_Selling_Capability) ---
/** Pull all available TLDs and wholesale pricing. */
public function sync_tlds(): array { ... }
/** Check availability of $domain_name across $tlds. */
public function search_domains(string $domain_name, array $tlds = []): array { ... }
/** Get wholesale price for a TLD for N years. */
public function get_domain_pricing(string $tld, int $years = 1): array { ... }
/** Register a domain. Returns ['success' => true, 'expiry_date' => '...'] on success. */
public function register_domain(string $domain_name, array $registrant_info, int $years = 1): array { ... }
/** Renew a domain for N years. */
public function renew_domain(string $domain_name, int $years = 1): array { ... }
/** Get registration status, expiry date, nameservers. */
public function get_domain_info(string $domain_name): array { ... }
/** Test API credentials and connectivity. */
public function test_connection(): array { ... }
}
Optional methods
Implement these to unlock additional features. The addon detects support via method_exists():
| Method | Unlocks |
|---|---|
supports_whois_privacy(): bool | WHOIS privacy option in product settings |
enable_whois_privacy(string $domain_name): array | Auto-enables privacy at registration |
get_dns_records(string $domain_name): array | Customer DNS view tab |
add_dns_record(string $domain_name, array $record_data): array | Customer can add DNS records |
update_dns_record(string $domain, string $record_id, array $record_data): array | Customer can edit DNS records |
delete_dns_record(string $domain, string $record_id, array $data): array | Customer can delete DNS records |
update_nameservers(string $domain_name, array $nameservers): array | Nameserver management |
get_epp_code(string $domain_name): array | Domain transfer (outgoing) |
transfer_domain(string $domain, string $auth_code, array $registrant_info, array $options): array | Domain transfer (incoming) |
Return value convention
All methods return an array with at minimum a success key:
// Success
return ['success' => true, 'data' => [...]];
// Failure
return ['success' => false, 'message' => 'Human-readable error'];