Setting Up USDT Payments for Unicard with Docker: A Comprehensive Guide

·

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 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:

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

  1. Search for BotFather on Telegram—ensure it's the official bot.
  2. Use the /newbot command to create a new bot. Follow the prompts to set a name and username.
  3. Upon completion, you'll receive an API token. Save this token for later use.

Step 3: Retrieve Your Telegram User ID

  1. Interact with @getmyid_bot on Telegram.
  2. 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/epusdt

Step 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:8000

Key adjustments:

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_ID

Ensure:

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.sql

Replace changeyourpassword with your actual database user password.

Step 8: Launch Services

Run the following commands to start the containers:

docker-compose up -d

Verify the service is operational by checking the logs:

docker logs -f epusdt_epusdt_1

Look 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

  1. Log into NPM's admin interface.
  2. Add a new proxy host with your domain, pointing to the server's IP and the port epusdt uses (e.g., 8090).
  3. 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

  1. In Unicard's admin panel, navigate to Configuration > Payment Settings.
  2. Enable epusdt and enter the required parameters:

    • Merchant ID: The api_auth_token from epusdt.conf.
    • Merchant Key: The API endpoint URL, typically https://yourdomain.com/api/v1/order/create-transaction.
  3. 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 prune

Uninstalling epusdt

For complete removal:

cd /root/data/docker_data/epusdt
docker-compose down
cd ..
rm -rf epusdt

Frequently 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.