Integrating bitcoin payments into your business doesn’t have to rely on third-party platforms. With okbitpay, a lightweight and secure Java-based bitcoin payment system, developers can deploy a private, self-hosted solution that connects directly to the Bitcoin blockchain. This guide walks you through setting up your own customizable bitcoin payment gateway—ideal for businesses, developers, and tech enthusiasts looking for full control over their financial infrastructure.
Whether you're building an e-commerce platform, a donation system, or a blockchain-powered financial tool, okbitpay offers the flexibility and transparency needed for seamless integration.
👉 Discover how to integrate secure blockchain payments in minutes
Why Choose a Self-Hosted Bitcoin Payment Solution?
Most online merchants depend on centralized payment processors that charge fees, require KYC verification, and may restrict certain transaction types. A self-hosted system like okbitpay eliminates these limitations by allowing you to:
- Own your payment flow end-to-end
- Avoid third-party fees and intermediaries
- Maintain complete privacy and data control
- Customize payment logic based on business needs
- Connect directly to the Bitcoin network via RPC
This makes it perfect for developers who value autonomy, security, and transparency in financial operations.
Core Features of okbitpay
okbitpay is built for simplicity and reliability. Key features include:
- Lightweight Java backend – Easily deployable with Maven
- Direct Bitcoin Core integration – Communicates securely via RPC
- Database persistence with MySQL – Stores order states and transaction logs
- RESTful API interface – Simple endpoints for creating and checking payment orders
- Automated callback system – Notifies your business system upon successful payment confirmation
- Support for HTTPS – Ensures secure communication (requires SSL certificate setup)
Core Keywords:
- Bitcoin payment system
- Java Bitcoin integration
- Self-hosted payment gateway
- Blockchain payment solution
- Bitcoin RPC client
- Open-source cryptocurrency payment
- Private Bitcoin wallet integration
- Decentralized payment processing
Step-by-Step Setup Guide
1. Install Bitcoin Core and Enable RPC
To interact with the blockchain, you need a local Bitcoin node running Bitcoin Core with Remote Procedure Call (RPC) enabled.
Edit your bitcoin.conf file (usually located in ~/.bitcoin/) and add:
server=1
rest=1
rpcbind=127.0.0.1:8332
rpcuser=root
rpcpassword=your_secure_password🔐 Use a strong, unique password. Never expose this configuration publicly.
Restart Bitcoin Core after saving the file to activate RPC services.
2. Configure okbitpay to Match Bitcoin Core Settings
Update the config.properties file in the okbitpay project to match your Bitcoin Core configuration:
rpcaddress=127.0.0.1
rpcuser=root
rpcpassword=your_secure_password
rpcport=8332
validation_level=6
maxretry_count=9The validation_level=6 ensures that a transaction is only marked as confirmed after six block confirmations—the industry standard for finality.
3. Set Up MySQL Database
Install MySQL and import the provided schema:
mysql -u root -p < okbitpay.sqlThis creates the necessary tables to store payment orders, statuses, addresses, and timestamps.
Ensure your application has proper database credentials and permissions.
4. Build the Project with Maven
Run the following command to compile the application:
mvn packageThis generates a deployable JAR or WAR file depending on your setup.
5. Enable HTTPS (Recommended)
For production use, always enable HTTPS to protect sensitive data.
Generate a PKCS12 keystore:
keytool -genkey -alias okbitpay -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650Replace the default keystore or obtain a trusted certificate from a Certificate Authority (CA). Update your server configuration accordingly.
⚠️ In Postman or other testing tools, disable SSL certificate verification only during development.
👉 Learn how to secure blockchain transactions with enterprise-grade tools
Using the okbitpay API
okbitpay provides three main REST endpoints for integrating bitcoin payments into your business logic.
1. Create a Payment Order
Endpoint: POST /bitcoinPayment/createPayOrder
Parameters:
amount: Amount in BTCorderId: Your internal order IDcallbackUrl: URL where status updates will be sent
Example request:
https://localhost:8443/bitcoinPayment/createPayOrder?amount=1&orderId=0000000000&callbackUrl=http://127.0.0.1:8080Response:
{
"status": "success",
"msg": "success",
"data": {
"code": "aa7eec07-efed-4d92-ae6a-b7861475291e",
"receiveAddress": "1Gx4KTvN6ShZVkY8Meu78gVHLaPfUHEhxx"
}
}Store the code and associate it with your order in your business system.
2. Check Payment Status
Endpoint: POST /bitcoinPayment/selectOneOrderByCode
Query Parameter: code
Returns detailed information including:
payStatus:pending,paid, orexpirereceiveAddressamountcreateTimecallbackUrl
Use this endpoint to manually verify payment status or debug issues.
3. Query All Payment Orders
Endpoint: POST /bitcoinPayment/selectPayOrderByPage
Returns paginated results of all payment records with filtering capabilities.
Useful for admin dashboards or reconciliation processes.
Payment Flow and Callback Mechanism
Once a user sends BTC to the generated address:
- okbitpay monitors the blockchain via Bitcoin Core.
- After 6 block confirmations, the system triggers a callback to your specified
callbackUrl. The callback includes three parameters:
code: Unique payment identifierorderId: Your original order referencepayStatus: Final status (paid,pending, etc.)
Example callback:
http://yourserver.com/callback?code=xxxxx&orderId=0000000000&payStatus=paidYour backend should listen for this event to finalize the purchase or unlock services.
⏱️ Transaction speed depends entirely on the miner fee attached to the incoming transaction—not on okbitpay. Higher fees result in faster confirmations.
Security Best Practices
To keep your system safe:
- Place both okbitpay and Bitcoin Core behind a firewall.
- Restrict external access—only allow connections from your trusted business systems.
- Never expose RPC credentials or private keys.
- Use strong passwords and rotate them periodically.
- Regularly back up your database and wallet.
Frequently Asked Questions (FAQ)
Q: Is okbitpay free to use?
Yes, okbitpay is open-source and free to use. There are no licensing fees or hidden costs. You only pay standard Bitcoin network miner fees when transactions are confirmed.
Q: Does okbitpay store private keys?
No. okbitpay does not manage private keys directly. It relies on Bitcoin Core’s wallet functionality for address generation and transaction signing. Your keys remain under your control.
Q: Can I customize the validation level?
Yes. By default, validation requires 6 block confirmations (validation_level=6). You can adjust this in config.properties, though lowering it increases risk of double-spending.
Q: What happens if an order expires?
Orders do not auto-expire within okbitpay by default. It's recommended to implement expiration logic in your business system based on createTime. You can disable old orders manually via status updates.
Q: How do I handle failed callbacks?
The system retries up to maxretry_count times (default: 9). If delivery fails permanently, you can manually query the order status using the API and sync it later.
Q: Can I use this for high-volume transactions?
Yes, but ensure your server has sufficient resources and bandwidth. For scalability, consider load balancing, caching layers, and monitoring tools.
👉 Explore advanced tools for managing blockchain payments at scale
Final Thoughts
okbitpay empowers developers to build decentralized, transparent, and cost-effective bitcoin payment systems without relying on external providers. With full control over security, data flow, and customization, it's an excellent choice for anyone serious about integrating cryptocurrency into their operations.
By hosting your own node and payment processor, you embrace the true spirit of decentralization—owning your financial infrastructure from end to end.