Integrating SUBTC Protocol with WordPress — A Developer’s Overview
The **SUBTC Protocol** provides a lightweight, secure, and AI-friendly Bitcoin execution layer. Integrating it with **WordPress** allows developers to build **BTC payment gateways** for various services such as marketplaces, hosting, and marketing platforms.
Base API: https://subtc.net/api
---
## 1. Architecture Overview
**Core Components:**
- **WordPress Frontend:** Acts as the user interface.
- **SUBTC Protocol:** Handles wallet management, payments, and confirmations.
- **API Connector:** PHP or REST client to call SUBTC endpoints.
- **Optional AI Agents:** Automate order fulfillment, notifications, or dynamic pricing.
**Flow:**
User → WordPress (checkout page) → SUBTC API → Bitcoin Network → Confirmation → Order Fulfillment
---
## 2. Wallet Management
Each customer or service can have **dedicated wallets**. Use the SUBTC API for:
1. **Create Wallet**
$resp = curl_post("https://api.subtc.net/v1/btc?mode=wallet_create", ['net' => 'main']);
$wallet_id = $resp['wallet_id'];2. Generate Receiving Address
$resp = curl_post("https://api.subtc.net/v1/btc?mode=wallet_receive", ['wallet_id'=>$wallet_id]);
$address = $resp['address'];3. Check Balance
$resp = curl_post("https://api.subtc.net/v1/btc?mode=wallet_balance", ['wallet_id'=>$wallet_id]);
$balance = $resp['result']['balance_sat'];
---
3. Payment Flow Strategy
1. Customer selects service (hosting, marketplace item, marketing service).
2. Generate SUBTC receiving address for the transaction.
3. Display QR code or BTC link on WordPress checkout.
4. Monitor payment using:
wallet_poll for non-blocking checks
wallet_wait_event for webhook or long polling confirmation
$resp = curl_post("https://api.subtc.net/v1/btc?mode=wallet_wait_event", [
'wallet_id'=>$wallet_id,
'address'=>$address,
'expected_sat'=>$amount_sat,
'timeout_sec'=>600,
'callback_url'=>'https://yourdomain.com/subtc-webhook'
]);5. Confirm transaction → automatically update order status.
---
4. Order Fulfillment Automation
Use WordPress hooks to trigger post-payment actions:
Provision hosting accounts
Grant digital product access
Activate marketing services
Optionally integrate AI agents to handle notifications and dynamic pricing.
---
5. Security Best Practices
Do not store SUBTC-KEY in the database. Use .env files or server environment variables.
Use Docker to isolate WordPress + SUBTC integration.
Daily transfers: Move funds from hot wallets to cold storage.
Enable idempotency: Use X-SUBTC-IDEMPOTENCY header to prevent double execution.
---
6. Use Cases
a. Marketplaces
Sell digital or physical goods
Each vendor can have a SUBTC wallet
Payments automatically processed and verified
b. Hosting Platforms
Customers pay with BTC
SUBTC API handles wallet creation and monitoring
Servers provisioned automatically
c. Marketing Services
Subscription services via BTC
AI agents manage campaign activation upon payment confirmation
---
7. Developer Notes
Prefer PHP with cURL for WordPress backend, but Python or Go microservices can handle heavy automation.
Webhook integration reduces polling load and ensures near real-time confirmations.
Use SUBTC Testnet for sandboxed testing before mainnet deployment.
---
Conclusion
Integrating SUBTC Protocol with WordPress empowers developers to:
Build autonomous BTC payment gateways
Automate fulfillment for various services
Securely manage wallets without handling sensitive private keys
Scale payment solutions efficiently across marketplaces, hosting, and digital services
The combination of WordPress flexibility + SUBTC’s deterministic, AI-friendly API creates a robust infrastructure for next-gen crypto-enabled platforms.