A payment gateway for sBTC (Stacks Bitcoin) with a Stripe-inspired API. Enables developers to accept Bitcoin payments through sBTC with hosted checkout pages, webhooks, and real-time transaction monitoring.
sBTC Express provides a REST API for creating and managing sBTC payments on the Stacks blockchain. It handles payment monitoring, transaction verification, and webhook delivery, allowing developers to integrate Bitcoin payments without managing blockchain infrastructure.
The service creates unique payment addresses for each transaction, monitors the Stacks blockchain for incoming sBTC transfers, validates amounts, and triggers webhooks when payments are detected and confirmed.
Payment Processing: Create payment requests with expiration times. Each payment generates a unique Stacks address and hosted checkout page with QR code.
Transaction Monitoring: Background service polls the Stacks blockchain API to detect sBTC transfers. Validates transaction amounts (accepts overpayments) and confirmations.
Webhooks: Configurable HTTP callbacks for payment events (created, detected, confirmed, failed). Includes signature verification and automatic retry logic.
API Authentication: JWT-based merchant authentication with API key support for programmatic access.
Real-time Updates: WebSocket connections for live payment status updates on checkout pages.
Built with Express.js and TypeScript. Uses SQLite for data persistence. Integrates with Stacks blockchain via @stacks/transactions and Hiro API. Supports both testnet and mainnet networks.
Key components:
PaymentController: Handles REST API endpointsSbtcService: Blockchain interaction and transaction verificationPaymentMonitoringService: Background polling for payment detectionWebhookService: Event delivery with retry logicWalletService: Payment address generation
The service polls the sBTC token contract transactions on Stacks, parses transfer events, matches them to pending payments, and updates payment status accordingly.