Designing Bitcoin Payment SDKs for WordPress
Research status: Theoretical SDK design. Examples are illustrative and have not been built or tested against the live engine.
Plugin architecture
Separate a reusable PHP transport client from WordPress hooks, administration screens and commerce adapters. The client normalizes documented engine responses; the plugin owns order mapping and permissions. A public checkout request must not carry BTC KEY or arbitrary engine URLs. Configure a trusted backend destination and validate TLS. Restrict configuration changes to authorized administrators and protect state-changing admin actions against CSRF.
Conceptual PHP adapter
interface PaymentGateway {
public function createIntent(string $orderId): PaymentIntent;
public function reconcile(string $intentId): SettlementEvidence;
}The adapter loads the order and price from trusted server records. It registers a payment watch using the core SDK and persists the returned identifier. The interface is proposed, not an existing WordPress or WAB class. Use WordPress HTTP facilities or an injected transport with bounded timeouts. Do not treat HTTP 200 alone as engine success; validate the application envelope and expected result.
Background processing
A scheduled worker polls documented WATCH and transaction status functions. WordPress traffic-driven scheduling may be delayed on quiet sites; use an external scheduler when timely reconciliation matters. Use a durable unique constraint or transactional lock for payment allocation. A nonce protects a request against certain cross-site attacks but does not replace authorization or payment idempotency. Mark a commerce order paid only after the configured evidence threshold. Keep secrets out of debug logs, HTML, REST responses and exported settings. Prefer an isolated payment service when the plugin host is shared or untrusted.
Acceptance plan
Test duplicate checkout submissions, unauthorized settings edits, malicious URL configuration, malformed JSON, worker overlap and delayed scheduling. Use a disposable WordPress installation and a Testnet wallet for a complete checkout or donation flow. Verify that repeated polling cannot duplicate fulfillment. Actual plugin compatibility and marketplace policies remain future validation work.
Primary reference
https://thamer.org/api
Related reading
https://thamer.org/docs/wab-sdk-api-engine-application-boundaries
https://thamer.org/docs/wab-sdk-authentication-credential-management
https://thamer.org/docs/wab-sdk-watch-payment-monitoring
https://thamer.org/docs/wab-sdk-invoice-abstractions
https://thamer.org/docs/wab-sdk-confirmation-settlement-states
https://thamer.org/docs/wab-sdk-payment-reconciliation
https://thamer.org/docs/wab-sdk-immutable-fee-policy
