SUBTC Protocol Integration with HostBill — Overview of Bitcoin Payment Gateway
## 1. Introduction
HostBill is a powerful billing and automation platform used for managing:
- VPS hosting
- Web hosting services
- Domain registration
- SaaS subscriptions
Integrating SUBTC Protocol turns HostBill into a **fully automated Bitcoin payment system** without relying on traditional payment processors.
---
## 2. Integration Concept
SUBTC acts as the **payment execution layer**
HostBill acts as the **billing and service management layer**
Flow:
Client → HostBill Invoice → SUBTC API → Bitcoin Network → Payment Confirmation → Service Activation
---
## 3. Core Integration Components
### 1. Custom Payment Gateway Module (HostBill)
A new gateway is created inside:
/includes/gateways/subtc/
Responsibilities:
- Generate BTC payment address per invoice
- Link invoice to SUBTC wallet/address
- Monitor payment status
- Automatically confirm payments
---
### 2. SUBTC API Integration Layer
HostBill communicates with SUBTC using HTTP requests (curl / PHP cURL).
Main operations:
- wallet_create
- wallet_receive
- wallet_poll
- wallet_wait_event
---
## 4. Payment Flow
### Step 1 — Invoice Creation
HostBill generates an invoice:
- invoice_id
- USD amount converted to satoshis
---
### Step 2 — Generate Payment Address
$response = curl_post("https://api.subtc.net/v1/btc?mode=wallet_receive", [
"wallet_id" => $wallet_id
]);
$address = $response["address"];The address is displayed to the customer.
---
Step 3 — Customer Payment
The user sends Bitcoin to the generated address.
HostBill stores:
address
expected_sat
invoice_id
---
Step 4 — Payment Monitoring
Option 1: Polling
curl_post("https://api.subtc.net/v1/btc?mode=wallet_poll", [
"wallet_id" => $wallet_id,
"address" => $address,
"expected_sat" => $amount_sat
]);Option 2: Webhook (Recommended)
curl_post("https://api.subtc.net/v1/btc?mode=wallet_wait_event", [
"wallet_id" => $wallet_id,
"address" => $address,
"expected_sat" => $amount_sat,
"callback_url" => "https://yourhostbill.com/subtc-webhook"
]);
---
Step 5 — Service Activation
When:
received_sat >= expected_sat
HostBill automatically:
Marks invoice as paid
Activates service (hosting/VPS/domain)
Sends confirmation to the client
---
5. Webhook Handler Example
$data = json_decode(file_get_contents("php://input"), true);
if ($data["reached"] && $data["received_sat"] >= $data["expected_sat"]) {
mark_invoice_paid($data["invoice_id"]);
activate_service($data["service_id"]);
}
---
6. Wallet Strategy
Recommended structure:
Hot Wallet (payment processing)
Operational Wallet (billing system funds)
Cold Wallet (secure storage)
Best practice:
Periodic withdrawal from hot wallet to cold storage
---
7. Security Best Practices
Store API keys in .env
Use HTTPS for all webhook endpoints
Validate webhook payloads
Use idempotency keys to prevent double processing
Restrict gateway access by IP if possible
---
8. Advantages of SUBTC + HostBill
No Bitcoin node required
No RPC complexity
Fully automated payments
Works on Mainnet & Testnet
AI-agent friendly architecture
Simple HTTP/cURL integration
---
9. Use Cases
VPS hosting companies
Web hosting providers
Domain registrars
SaaS subscription services
Digital product platforms
---
10. Conclusion
SUBTC transforms HostBill into a Bitcoin-native billing system.
HostBill = billing & automation layer
SUBTC = Bitcoin payment execution layer
Result:
→ Fully automated, API-driven Bitcoin hosting infrastructure.