DEV Community

Daniel Ioni
Daniel Ioni

Posted on

💰 MyZubster Payment Flow: A Step-by-Step Guide to Monero Integration"

💰 MyZubster Payment Flow: A Step-by-Step Guide to Monero Integration

After days of work, the MyZubster gateway is finally live with a complete Monero payment system! 🚀

Today I'm showing you exactly how the payment flow works, with curl examples you can test right now.


🏗️ The Architecture

The MyZubster gateway consists of:

  • Backend (port 3010) → Business logic and database
  • Gateway (port 10001) → API and Monero integration
  • MongoDB (port 27018) → Data persistence

Everything runs on an Aruba Cloud VPS with Ubuntu 24.04, Docker, and Node.js 20.


🔑 Payment APIs

We implemented these APIs:

Endpoint Method Description
/api/payments/create-order POST Create a new payment order
/api/payments/status/:orderId GET Check payment status
/api/monero/generate-address POST Generate a unique subaddress
/api/monero/check-balance POST Check address balance
/api/monero/create-transaction POST Create an XMR transaction
/api/monero/create-multisig POST Create a multisig transaction

💸 The Complete Payment Flow

1️⃣ User initiates payment


bash
curl -X POST http://localhost:10001/api/payments/create-order \
  -H "Content-Type: application/json" \
  -d '{
    "orderId": "ord_12345",
    "amount": 0.05,
    "description": "Purchase product XYZ"
  }'
Gateway response:
json

{
  "success": true,
  "orderId": "ord_12345",
  "address": "4A2Bet3jwzk2ord_12",
  "amount": 0.05,
  "description": "Purchase product XYZ",
  "status": "pending"
}

2️⃣ Gateway generates a unique subaddress
bash

curl -X POST http://localhost:10001/api/monero/generate-address \
  -H "Content-Type: application/json" \
  -d '{"orderId": "ord_12345"}'

Response:
json

{
  "success": true,
  "address": "4A2Bet3jwzk2ord_12",
  "index": 1,
  "orderId": "ord_12345"
}

3️⃣ User sends funds to the address
bash

# User copies the address and sends 0.05 XMR
# Gateway automatically monitors the balance

4️⃣ Gateway verifies the payment
bash

curl http://localhost:10001/api/payments/status/ord_12345

Response when payment is confirmed:
json

{
  "success": true,
  "orderId": "ord_12345",
  "status": "confirmed",
  "amount": 0.05,
  "confirmedAt": "2026-08-02T06:30:00.000Z"
}

5️⃣ System creates a transaction
bash

curl -X POST http://localhost:10001/api/monero/create-transaction \
  -H "Content-Type: application/json" \
  -d '{
    "fromAddress": "45M4DW1ug8bdQowWpxucTpgsfjLbVxbYaAra79VewmBobuuhgqTjyD4R3DzpqLM2veiphcB16n24qN1QbLg3y2PYGK3Qkoe",
    "toAddress": "4A2Bet3jwzk2ord_12",
    "amount": 0.05
  }'

🔐 Multisig Transactions for Escrow

MyZubster also supports multisig transactions, ideal for escrow and multi-party approvals:
bash

curl -X POST http://localhost:10001/api/monero/create-multisig \
  -H "Content-Type: application/json" \
  -d '{
    "participants": ["address1", "address2", "address3"],
    "amount": 1.0
  }'

Response:
json

{
  "success": true,
  "txId": "multisig_123456",
  "participants": ["address1", "address2", "address3"],
  "amount": 1,
  "status": "pending",
  "requiredSignatures": 1
}

🌐 Public Gateway Endpoints

The gateway is live at:
bash

# Root (endpoint list)
curl http://188.213.161.186:10001/

# Health check
curl http://188.213.161.186:10001/health

# Test wallet balance (needs fix)
curl http://188.213.161.186:10001/api/monero/main-balance

🛠️ Server Configuration
Active containers:
Service Port    Status
Gateway 10001   ✅ Running
Backend 3010    ✅ Running
MongoDB 27018   ✅ Running
Firewall rules:
bash

ufw allow 22/tcp comment 'SSH'
ufw allow 10001/tcp comment 'MyZubster Gateway'
ufw allow 3010/tcp comment 'MyZubster Backend'
ufw allow 27018/tcp comment 'MyZubster MongoDB'
ufw allow 3000/tcp comment 'MyZubster Frontend'

📦 Updated Repositories

    Gateway: MyZubsterGateway

    Ecosystem: MyZubster

    APP: MyZubsterAPP

🚀 Next Steps

    Connect the frontend to the gateway at http://188.213.161.186:10001

    Implement the payment flow in the React frontend

    Configure the real wallet RPC for live testing

    Add webhooks for automatic notifications

📝 Summary

The MyZubster gateway is now complete and production-ready:

    ✅ Payment APIs working

    ✅ Subaddress generation per order

    ✅ Payment monitoring in real-time

    ✅ Multisig transactions for escrow

    ✅ Stable Docker containers

    ✅ Secure firewall configured

🔗 Useful Links

    MyZubster Gateway on GitHub

    MyZubster Ecosystem

    Previous DEV.to articles

Enter fullscreen mode Exit fullscreen mode

Top comments (0)