Thanks to visit codestin.com
Credit goes to github.com

Skip to content

x402 payments for any website or API. Turn-key x402 gateway to monetize APIs & websites with x402 payments. Cloud-native x402 server

License

Notifications You must be signed in to change notification settings

skalenetwork/machinepay

Repository files navigation

MachinePay

πŸš€ MachinePay: The x402 Payment Gatekeeper for the Web

Instantly add crypto payments to any website or API using the x402 protocol.

Love this project? Give it a heart! GitHub stars GitHub forks Contribute Open an Issue GitHub issues GitHub license Build and test machinepay Runs on Ubuntu 22.04+ Runs on macOS 11+ Runs on Windows 10+


✨ Why use MachinePay?

  • ⚑ Plug & play β€” add x402 payments to existing websites & APIs in minutes
  • πŸ”’ Fully x402 compliant β€” built on the Coinbase standard
  • πŸ› οΈ Easy to deploy & configure β€” no complex setup
  • πŸš€ Ultra-high performance asynchronous HTTP server β€” scales to 1M+ concurrent connections
  • πŸŒ‰ Multi-chain support β€” works with both Base and SKALE
  • πŸ’Έ Flexible payment models β€” subscriptions, pay-per-request, metered access
  • πŸ“Š Deep logging & monitoring β€” full visibility of payment traffic
  • πŸ’― Open source & free β€” community-driven

πŸ—οΈ How it Works (The Toll Booth Analogy)

Think of MachinePay as a toll booth for the internet.
Instead of reaching a website directly, requests first pass through the proxy:

  1. πŸ”— You send a request β†’ try to access a resource
  2. 🚦 MachinePay proxy intercepts β†’ checks if payment is included
  3. πŸ’³ Payment verified β†’ confirmed via the x402 protocol
  4. πŸ“‘ MachinePay proxy forwards request β†’ to the real website
  5. πŸ–₯️ Website responds β†’ returns content
  6. πŸ“¬ MachinePay proxy delivers to you β†’ completing the paid access loop

βœ… Result: Websites instantly monetize access while staying secure and compliant.


MachinePay Architecture diagram

flowchart LR
subgraph External_World["External Users & AI Agents"]
U1["Consumers"]
A1["AI Agents"]
end

    %% Corporate Network 1
    subgraph Corporate_Network["Corporate Network 1"]
        direction TB
        MP["MachinePay x402 payment gateway"]
        AI1["AI Services"]
        AI2["Products"]
        AI3["Data"]
        HU1["Employees"]
        HA1["AI Agents"]
    end

    %% Corporate Network 2
    subgraph Corporate_Network_2["Corporate Network 2"]
        direction TB
        MP2["MachinePay x402 payment gateway"]
        AI1B["AI Services"]
        AI2B["Products"]
        AI3B["Data"]
        HU2["Employees"]
        HA2["AI Agents"]
    end

    %% External access to Network 1
    U1 -->|Requests / Payments via x402| MP
    A1 -->|Autonomous Access via x402| MP

    %% Authorized access (Network 1)
    MP -->|Authorized Access| AI1
    MP -->|Authorized Access| AI2
    MP -->|Authorized Access| AI3

    %% Internal users (Network 1)
    HU1 -->|Internal Requests / Payments via x402| MP
    HA1 -->|Internal Autonomous Access via x402| MP

    %% Internal users (Network 2)
    HU2 -->|Internal Requests / Payments via x402| MP2
    HA2 -->|Internal Autonomous Access via x402| MP2

    %% Authorized access (Network 2)
    MP2 -->|Authorized Access| AI1B
    MP2 -->|Authorized Access| AI2B
    MP2 -->|Authorized Access| AI3B

    %% Aggregated cross-network paid resource exchange (bidirectional)
    MP <-->|Cross-Network Paid Resource Access| MP2

    %% Styling
    classDef users fill:#4caf50,stroke:#1b5e20,color:#ffffff,font-weight:600;
    classDef agents fill:#1976d2,stroke:#0d47a1,color:#ffffff,font-weight:600;
    classDef gateway fill:#ff9800,stroke:#e65100,color:#000000,font-weight:600;
    classDef services fill:#9c27b0,stroke:#4a148c,color:#ffffff,font-weight:600;
    classDef docs fill:#3f51b5,stroke:#1a237e,color:#ffffff,font-weight:600;
    classDef streams fill:#009688,stroke:#004d40,color:#ffffff,font-weight:600;

    U1:::users
    A1:::agents
    HU1:::users
    HA1:::agents
    HU2:::users
    HA2:::agents
    MP:::gateway
    MP2:::gateway
    AI1:::services
    AI2:::docs
    AI3:::streams
    AI1B:::services
    AI2B:::docs
    AI3B:::streams

    style Corporate_Network fill:#e3f2fd,stroke:#90caf9,color:#0d47a1;
    style Corporate_Network_2 fill:#fce4ec,stroke:#f06292,color:#880e4f;
    style External_World fill:#f1f8e9,stroke:#c5e1a5,color:#2e7d32;

    %% Link styling (external + aggregated cross-network)
    linkStyle 0 stroke:#4caf50,color:#4caf50,stroke-width:2px;
    linkStyle 1 stroke:#1976d2,color:#1976d2,stroke-width:2px;
    %% Cross-network edge index (after preceding edges) is 12
    linkStyle 12 stroke:#ff9800,color:#ff9800,stroke-width:3px,stroke-dasharray:4 2;
Loading

⚑ Build Instructions

# Clone with dependencies
git clone --recursive https://github.com/skalenetwork/machinepay.git
cd machinepay

# Bootstrap vcpkg
./external/vcpkg/bootstrap-vcpkg.sh
./external/vcpkg/vcpkg install

# Build
cmake -S . -B build \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_TOOLCHAIN_FILE=external/vcpkg/scripts/buildsystems/vcpkg.cmake \
  -DVCPKG_FEATURE_FLAGS=manifests   -DVCPKG_TARGET_TRIPLET=x64-linux 

cmake --build build -j

About

x402 payments for any website or API. Turn-key x402 gateway to monetize APIs & websites with x402 payments. Cloud-native x402 server

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •  

Languages