In the evolving world of digital commerce, accepting cryptocurrency payments can significantly enhance your online store's capabilities. This guide walks you through integrating USDT (Tether) payments into Unicard (独角数卡) using Docker, enabling you to receive cryptocurrencies effortlessly.
Why Use USDT Payments?
USDT, or Tether, is a stablecoin pegged to the US dollar, offering the benefits of cryptocurrency transactions—such as fast processing and lower fees—without the volatility typically associated with other digital currencies. Integrating USDT payments into your Unicard setup allows you to tap into the growing crypto market, providing customers with more payment options and potentially increasing sales.
Prerequisites and Setup Environment
Before diving into the setup, ensure you have the following components ready:
- Server: A virtual private server (VPS) hosted outside mainland China is recommended due to the nature of cryptocurrency transactions. Options like RackNerd's cost-effective plans are suitable.
- Operating System: Debian 11 or Ubuntu. While the original system can be used, these distributions are tested and verified.
- Docker and Docker Compose: Essential for containerized deployment. Installation scripts are widely available.
- Domain Name: Registered and properly DNS-resolved to your server. This is crucial for secure HTTPS access.
- Telegram Account: Required for creating a bot to manage payment notifications.
Server requirements are minimal: 1GB of RAM is sufficient, provided Docker runs smoothly.
Project Overview and Key Addresses
The core of this setup involves epusdt, an open-source solution for handling USDT payments. Here are the essential references:
- Official GitHub Repository: https://github.com/assimon/epusdt
- Docker Image Used: Based on Stille's Dockerfiles
These resources provide the foundation for deploying your payment gateway.
Step-by-Step Installation Guide
Step 1: Install Docker and Nginx Proxy Manager
Begin by setting up Docker and Nginx Proxy Manager (NPM) on your server. NPM simplifies managing reverse proxies and SSL certificates, ensuring secure connections.
Step 2: Create a Telegram Bot
- Search for
BotFatheron Telegram—ensure it's the official bot. - Use the
/newbotcommand to create a new bot. Follow the prompts to set a name and username. - Upon completion, you'll receive an API token. Save this token for later use.
Step 3: Retrieve Your Telegram User ID
- Interact with
@getmyid_boton Telegram. - The bot will reply with your numeric user ID. Note this down.
Step 4: Set Up the Installation Directory
Access your server via SSH and execute the following commands to create the necessary directory structure:
sudo -i
mkdir -p /root/data/docker_data/epusdt
cd /root/data/docker_data/epusdtStep 5: Configure Docker Compose
Create a docker-compose.yml file with the following content. Adjust parameters like database passwords and ports as needed:
version: "3"
services:
db:
image: mariadb:focal
restart: always
environment:
- MYSQL_ROOT_PASSWORD=changeyourpassword
- MYSQL_DATABASE=epusdt
- MYSQL_USER=epusdt
- MYSQL_PASSWORD=changeyourpassword
volumes:
- ./mysql:/var/lib/mysql
redis:
image: redis:alpine
restart: always
volumes:
- ./redis:/data
epusdt:
image: stilleshan/epusdt
restart: always
volumes:
- ./epusdt.conf:/app/.env
ports:
- 8000:8000Key adjustments:
- Replace
changeyourpasswordwith strong, unique passwords forMYSQL_ROOT_PASSWORDandMYSQL_PASSWORD. - Modify the port mapping (e.g.,
58000:8000) if port8000is occupied.
Step 6: Environment Configuration
Create an epusdt.conf file to store environment variables. Pay attention to these critical fields:
app_name=epusdt
app_uri=https://yourdomain.com
http_listen=:8000
mysql_passwd=changeyourpassword
api_auth_token=changeyourpassword
tg_bot_token=YOUR_TELEGRAM_BOT_TOKEN
tg_manage=YOUR_TELEGRAM_USER_IDEnsure:
app_urimatches your domain.mysql_passwdaligns with the Docker Compose database user password.api_auth_tokenis a custom password for Unicard integration.- Telegram token and user ID are correctly inserted.
Step 7: Database Initialization
Use the provided SQL schema to initialize the database. Execute:
docker exec -i epusdt-db-1 sh -c 'exec mysql -uepusdt -pchangeyourpassword epusdt' < epusdt.sqlReplace changeyourpassword with your actual database user password.
Step 8: Launch Services
Run the following commands to start the containers:
docker-compose up -dVerify the service is operational by checking the logs:
docker logs -f epusdt_epusdt_1Look for http server started on [::]:8000 in the output.
Step 9: Firewall Configuration
Open the necessary port (e.g., 8090) in your server's firewall. This step varies by hosting provider; consult their documentation if unsure.
Setting Up Reverse Proxy
For security and professionalism, access your service via a domain name with HTTPS encryption.
Using Nginx Proxy Manager
- Log into NPM's admin interface.
- Add a new proxy host with your domain, pointing to the server's IP and the port
epusdtuses (e.g.,8090). - Enable SSL certificates through Let's Encrypt directly in NPM.
Alternative: Direct Nginx Configuration
If using bare Nginx, add a server block with:
location / {
proxy_pass http://127.0.0.1:8090/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}Replace 8090 with your actual port.
Integrating with Unicard
- In Unicard's admin panel, navigate to Configuration > Payment Settings.
Enable
epusdtand enter the required parameters:- Merchant ID: The
api_auth_tokenfromepusdt.conf. - Merchant Key: The API endpoint URL, typically
https://yourdomain.com/api/v1/order/create-transaction.
- Merchant ID: The
- Use the Telegram bot to generate and manage USDT receiving addresses.
Test the integration by creating a dummy order to ensure payments are processed correctly.
Maintenance and Updates
Updating epusdt
To update to the latest version:
cd /root/data/docker_data/epusdt
docker-compose down
docker-compose pull
docker-compose up -d
docker image pruneUninstalling epusdt
For complete removal:
cd /root/data/docker_data/epusdt
docker-compose down
cd ..
rm -rf epusdtFrequently Asked Questions
Q: Can I use a different cryptocurrency instead of USDT?
A: The epusdt solution is specifically designed for USDT transactions. Integrating other cryptocurrencies would require significant modifications or a different payment gateway.
Q: Is it safe to run this on a server outside my country?
A: Yes, provided you choose a reputable hosting provider. Ensure the server complies with data protection regulations applicable to your business.
Q: How do I handle rate fluctuations in USDT?
A: USDT is a stablecoin pegged to the USD, minimizing volatility. The forced_usdt_rate parameter in epusdt.conf can lock exchange rates if needed.
Q: What happens if the Telegram bot goes offline?
A: The bot is primarily for notifications and address management. Transactions are processed on-chain, so payments will still be received, but alerts might be delayed.
Q: Can I use this with other shopping carts besides Unicard?
A: While tailored for Unicard, epusdt provides API endpoints that could be integrated into other platforms with custom development.
Q: How do I troubleshoot failed payments?
A: Check Docker logs for epusdt and ensure all configuration parameters match between Unicard and your epusdt.conf file. 👉 Explore more strategies for debugging payment gateways.
Conclusion
Integrating USDT payments into your Unicard platform via Docker opens up new avenues for customer transactions. By following this guide, you’ve deployed a secure, efficient cryptocurrency payment system. Always keep software updated and monitor transactions regularly for optimal performance.
For further reading and community support, visit the official epusdt GitHub repository. Contributions and feedback are welcome to enhance the project.