Integrating SUBTC Protocol with WHMCS — Overview

permalink SUBTC
#integrating#overview#protocol#subtc#whmcs

The SUBTC Protocol can be integrated with WHMCS to enable seamless Bitcoin payments for hosting, domains, and services. WHMCS, being a PHP-based billing and automation platform, can interact with SUBTC via API calls for wallet creation, payment processing, and event monitoring.

Base API: https://subtc.net/api


🌐 Why WHMCS + SUBTC Works

  • WHMCS supports custom payment gateways via modules
  • SUBTC API provides a curl-first interface, perfect for server-side calls
  • Developers can automate BTC payments without handling Bitcoin nodes
  • Supports AI agents or automated scripts for advanced workflows

⚙️ Integration Architecture

  1. WHMCS Payment Gateway Module
  • Create a custom module in modules/gateways/
  • Module calls SUBTC endpoints for:
  • Wallet creation (wallet_create)
  • Generating receiving addresses (wallet_receive)
  • Sending payments (wallet_send)
  • Polling for incoming transactions (wallet_poll)
  1. Payment Flow Example
// Example: WHMCS gateway module call
$api_key = 'YOUR_SUBTC_KEY';
$wallet_id = 'CLIENT_WALLET_ID';

// Create receive address
$ch = curl_init("https://api.subtc.net/v1/btc?mode=wallet_receive");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "X-SUBTC-KEY: $api_key",
    "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    "wallet_id" => $wallet_id
]));
$response = curl_exec($ch);
curl_close($ch);

$address = json_decode($response, true)['result']['address'];
  1. Event Handling

Use wallet_wait_event or wallet_poll to confirm client payments

Trigger WHMCS invoice update and service activation

// Poll for payment
$ch = curl_init("https://api.subtc.net/v1/btc?mode=wallet_poll");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    "wallet_id" => $wallet_id,
    "address" => $address,
    "expected_sat" => $amount_sat
]));

💡 Best Practices

Keep SUBTC KEY secure: Store in .env or WHMCS configuration securely

Daily payout: Move funds from hot wallet to personal cold storage

Docker isolation: Run modules or scripts in containers for security

AI automation: Bots can automatically manage invoice payments, refunds, or notifications


🧩 Use Cases

Accept BTC for domain registrations

Collect payments for hosting services

Subscription services automation

Donation or tipping integration


Conclusion

Integrating SUBTC Protocol with WHMCS creates a lightweight, secure, and fully automated Bitcoin payment system. The API-first design allows developers to:

Build custom gateways

Automate wallet management

Monitor transactions in real-time

This setup is ideal for hosting providers, freelancers, and businesses seeking decentralized BTC payment infrastructure without maintaining Bitcoin nodes.