dibayar.in
Home βΊ openclaw βΊ Setup
Payment Bot di VPS
Setup Self-Hosted openclaw Payment Bot di VPS Linux: Complete Implementation
Panduan lengkap dan praktis untuk setup self-hosted openclaw payment bot di VPS Linux.
Dari provision VPS, install dependensi, konfigurasi openclaw, sampai payment bot siap running 24/7
di production environment.
π‘ Apa yang Akan Anda Pelajari: Setup complete payment bot infrastructure dengan
openclaw, termasuk VPS configuration, API integration, security hardening, dan monitoring.
Prerequisites: Apa yang Dibutuhkan
VPS Linux: Ubuntu 20.04/22.04 atau Debian (2GB RAM minimal, 4GB recommended)
API Key: OpenAI API key atau Anthropic Claude API key
Domain: Domain opsional untuk webhook endpoint
Payment Gateway: Akun Midtrans/Xendit/Stripe untuk payment processing
Basic Linux Knowledge: Familiar dengan command line dan SSH
Architecture Overview
Stack yang Akan Kita Setup:
VPS: Ubuntu/Debian server di DigitalOcean, Linode, atau provider lain
openclaw: AI engine untuk processing dan automasi
Database: PostgreSQL untuk transaction data
Webhook Server: Flask/FastAPI untuk menerima payment notification
Process Manager: PM2 atau systemd untuk keep bot running
Reverse Proxy: Nginx untuk SSL dan domain routing
Langkah 1: Provision dan Setup VPS
1.1 Create VPS Instance
Login ke provider (DigitalOcean, Linode, Vultr, dll)
Create new droplet/server dengan spesifikasi:
OS: Ubuntu 22.04 LTS
Plan: Basic, 2GB RAM, 1 CPU, 40GB SSD
Location: Singapore (terdekat ke Indonesia)
Set SSH key untuk secure access
1.2 Initial Server Setup
Setelah VPS ready, SSH ke server:
ssh root@your-vps-ip
Kemudian jalankan initial setup:
Update system: apt update && apt upgrade -y
Create non-root user: adduser openclaw
Grant sudo privileges: usermod -aG sudo openclaw
Setup firewall: ufw allow OpenSSH && ufw enable
Langkah 2: Install Dependensi
2.1 Install Python & Tools
Install Python 3: apt install python3 python3-pip python3-venv -y
Install Node.js (jika needed): curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt install nodejs -y
Install Git: apt install git -y
2.2 Install Database
Install PostgreSQL: apt install postgresql postgresql-contrib -y
Create database untuk payment bot:
sudo -u postgres psql
CREATE DATABASE paymentbot;
CREATE USER openclaw WITH PASSWORD 'REPLACE_WITH_SECURE_PASS';
GRANT ALL PRIVILEGES ON DATABASE paymentbot TO openclaw;
2.3 Install Nginx
apt install nginx -y
ufw allow 'Nginx Full'
Langkah 3: Setup openclaw
3.1 Clone dan Install openclaw
Switch ke openclaw user: su - openclaw
Clone repository: git clone https://github.com/your-openclaw-fork.git
Enter directory: cd openclaw
Create virtual environment: python3 -m venv venv
Activate: source venv/bin/activate
Install dependencies: pip install -r requirements.txt
3.2 Konfigurasi Environment
Buat file .env dengan konfigurasi:
OpenAI API Key: OPENAI_API_KEY=YOUR_OPENAI_KEY_HERE
Database URL: Format postgresql connection string (ganti USER dan PASSWORD)
Payment Gateway Keys: Midtrans/Xendit/Stripe keys
Bot Tokens: Telegram/WhatsApp bot tokens
Security: JWT secret, encryption keys
Langkah 4: Setup Payment Integration
4.1 Payment Gateway Configuration
Setup Midtrans/Xendit account
Get API keys (Server Key dan Client Key)
Configure webhook URL dalam dashboard payment gateway
Test payment flow dengan sandbox environment
4.2 Implement Webhook Handler
Setup webhook endpoint untuk menerima payment notification:
Create Flask/FastAPI application
Define webhook endpoint (misal: /webhook/payment)
Verify webhook signature untuk security
Process payment notification dan update database
Trigger openclaw untuk send notification ke customer
Langkah 5: Setup Process Manager
5.1 Install PM2
npm install -g pm2
Create ecosystem file: pm2 init
Edit ecosystem.config.js dengan konfigurasi bot
5.2 Start Bot dengan PM2
pm2 start payment-bot.py --name openclaw-payment
Save PM2 config: pm2 save
Setup startup script: pm2 startup
Langkah 6: Setup SSL dan Domain
6.1 Setup Nginx Reverse Proxy
Create nginx config di /etc/nginx/sites-available/paymentbot:
Configure upstream ke application (port 8000 atau lainnya)
Setup server block dengan domain Anda
Enable config: ln -s /etc/nginx/sites-available/paymentbot /etc/nginx/sites-enabled/
Test dan restart nginx: nginx -t && systemctl restart nginx
6.2 Setup SSL dengan Let's Encrypt
Install Certbot: apt install certbot python3-certbot-nginx -y
Get SSL certificate: certbot --nginx -d yourdomain.com
Setup auto-renewal (certbot handle ini otomatis)
Langkah 7: Security Hardening
β
Firewall: Only allow necessary ports (80, 443, SSH)
β
SSH: Disable password login, gunakan key-based auth
β
App Secrets: Store dalam environment variables, jangan hardcode
β
Database: Strong password, restrict remote access
β
Rate Limiting: Implement rate limiting di Nginx/App level
β
Monitoring: Setup log monitoring dan alerting
Langkah 8: Testing dan Deployment
8.1 Testing Payment Flow
Test dengan sandbox environment payment gateway
Verify webhook endpoint menerima notification
Confirm bot mengirim notifikasi ke customer
Check database transaction ter-record dengan benar
8.2 Go Live
Switch payment gateway ke production mode
Monitor logs untuk beberapa jam pertama
Have rollback plan siap jika ada issues
Setup monitoring dan alerting (opsional: UptimeRobot, PagerDuty)
Maintenance dan Monitoring
π Logs: Check bot logs regularly: pm2 logs openclaw-payment
π Database: Backup database regularly (cron job)
π Updates: Keep dependencies updated untuk security patches
π Performance: Monitor CPU, RAM, dan disk usage
π Uptime: Setup uptime monitoring
Troubleshooting Common Issues
Bot tidak start: Check logs, verify API keys, test database connection
Webhook tidak terζ₯ζΆ: Verify nginx config, check firewall, test SSL
Payment not processing: Verify payment gateway credentials, check sandbox/production mode
High memory usage: Consider upgrade VPS atau optimize code
Bot crash: Setup auto-restart dengan PM2, implement error handling
Butuh Bantuan Setup VPS dan API untuk Payment Bot?
Jika Anda tidak punya kartu kredit untuk sewa VPS (DigitalOcean, Linode, dll) atau beli API key
(OpenAI, Claude), dibayar.in siap membantu setup complete payment bot infrastructure!
Chat Admin - Setup VPS & API
Kami bantu sewa VPS, beli API key AI, setup payment gateway integration, dan konfigurasi lengkap.
Tanpa kartu kredit, bayar via QRIS atau transfer bank lokal!