[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-116117":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":44,"updatedAt":45,"readmeContent":46,"aiSummary":47,"trendingCount":16,"starSnapshotCount":16,"syncStatus":48,"lastSyncTime":49,"discoverSource":50},116117,"Stablecoin-Payment-Gateway","zgraham1981\u002FStablecoin-Payment-Gateway","zgraham1981","Self-hosted, non-custodial stablecoin payment gateway with x402 and invoice checkout. Accepts USDC, USDT, PYUSD and DAI across 8 networks with QR payments, payment links, settlement tracking and signed webhooks. REST API, micropayments, exports, zero platform fees and no KYC. Python, cross-platform.","",null,"Python",270,42,57,1,0,72,72.1,"MIT License",false,"main",true,[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"coinbase-x402","coinpayments-api","crypto-payment-system","cryptopayments","e-wallet","merchant-payment-api","online-payment-system","online-payments","paygate","payment","payment-gateway","payment-gateway-integration","payment-gateways","payment-orchestration","payment-system","paymentgateway","stablecoin-payments","web3-payments","x-402","x402","2026-11-23 20:50:58","2026-11-21 18:58:35","# Stablecoin-Payment-Gateway\nSelf-hosted, non-custodial stablecoin payment gateway with x402 and invoice checkout. Accepts USDC, USDT, PYUSD and DAI across 8 networks with QR payments, payment links, settlement tracking and signed webhooks. REST API, micropayments, exports, zero platform fees and no KYC. Python, cross-platform.\n---\n\n\u003Cdiv align=\"center\">\n\n# Stablecoin Payment Gateway\n\n**Self-Hosted x402 Gateway — Multi-Chain USDC\u002FUSDT Merchant API**\n\n[![Python](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPython-3.10%2B-3776AB?style=for-the-badge&logo=python&logoColor=white)](https:\u002F\u002Fpython.org)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-green?style=for-the-badge)](LICENSE)\n[![Platform](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPlatform-Windows%20%7C%20Linux%20%7C%20macOS-blue?style=for-the-badge)]()\n[![x402](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FProtocol-x402%20%7C%20HTTP%20402-FF6600?style=for-the-badge)]()\n[![Custody](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCustody-Non--Custodial-brightgreen?style=for-the-badge)]()\n\n---\n\n*Self-hosted stablecoin payment gateway with x402 protocol support.\u003Cbr>Accept USDC\u002FUSDT across 8 chains with invoices, payment links, signed webhooks\u003Cbr>and HTTP 402 pay-per-request monetization — funds settle straight to your wallet.*\n\n[Features](#features) · [How x402 Works](#how-x402-works) · [Invoices](#invoices--checkout) · [Getting Started](#getting-started) · [Configuration](#configuration) · [Usage](#usage) · [FAQ](#faq)\n\n\u003C\u002Fdiv>\n\n---\n\n## Features\n\n\u003Ctable>\n\u003Ctr>\n\u003Ctd width=\"50%\">\n\n### Payments\n| Feature | Status |\n|---------|--------|\n| Fixed-Amount Invoices | ✅ |\n| Unique Deposit Address per Invoice | ✅ |\n| Shareable Payment Links | ✅ |\n| QR Checkout Payloads | ✅ |\n| x402 HTTP 402 Paywall | ✅ |\n| Under\u002FOver-Payment Handling | ✅ |\n| Invoice TTL & Auto-Expiry | ✅ |\n| Mempool + Block Watchers | ✅ |\n\n\u003C\u002Ftd>\n\u003Ctd width=\"50%\">\n\n### Merchant Stack\n| Feature | Status |\n|---------|--------|\n| HMAC-SHA256 Signed Webhooks | ✅ |\n| Scoped Merchant API Keys | ✅ |\n| Key Rotation with Grace Period | ✅ |\n| Per-Chain Confirmation Policy | ✅ |\n| xpub Address Derivation | ✅ |\n| Settlement CSV\u002FJSON Export | ✅ |\n| 0% Platform Fees \u002F No KYC | ✅ |\n| Self-Hosted (Docker-friendly) | ✅ |\n\n\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n---\n\n## How x402 Works\n\nx402 is an open payment standard built on HTTP — it resurrects the `402 Payment Required` status code so any endpoint can become payable in one line:\n\n```\nClient                          Gateway (resource server)              Facilitator\n  │  GET \u002Fapi\u002Fpremium                 │                                    │\n  │ ────────────────────────────────> │                                    │\n  │  402 + accepted networks\u002Fassets   │                                    │\n  │ \u003C──────────────────────────────── │                                    │\n  │  GET + X-PAYMENT (signed payload) │                                    │\n  │ ────────────────────────────────> │  POST \u002Fverify ──────────────────>  │\n  │                                   │ \u003C─────────────────────── valid ─── │\n  │                                   │  POST \u002Fsettle ──────────────────>  │\n  │                                   │ \u003C──────────── tx hash (settled) ── │\n  │  200 OK + PAYMENT-RESPONSE        │                                    │\n  │ \u003C──────────────────────────────── │                                    │\n```\n\n1. **402 Challenge** — unpaid requests get a `402` response listing accepted `(network, asset)` pairs\n2. **X-PAYMENT** — the client signs a stablecoin transfer authorization and retries\n3. **Verify & Settle** — the gateway verifies the payload through the facilitator and settles on-chain\n4. **Receipt** — the response carries `PAYMENT-RESPONSE` with the settlement transaction hash\n\nThe gateway supports the `exact` scheme (fixed amount per call) on Base, Ethereum, Polygon and Arbitrum, with server-side control over which networks clients may pay on.\n\n---\n\n## Invoices & Checkout\n\nClassic merchant flow for shops, SaaS and donations:\n\n- **Invoice** — fixed amount in USDC\u002FUSDT, unique deposit address derived from your xpub, 30-minute TTL (configurable)\n- **Checkout URL** — hosted page with QR payload; works from any wallet app\n- **Watchers** — mempool scanner detects the payment in seconds; block watcher counts confirmations to the per-chain floor\n- **Webhooks** — `invoice.created → invoice.paid → invoice.settled`, signed with HMAC-SHA256, retried with `5s → 30s → 120s` backoff\n- **Edge cases** — underpayments within tolerance auto-accept; overpayments credit the customer balance; expired invoices release the address back to the pool\n\n### Why self-hosted?\n\n| | Hosted processors | **This gateway** |\n|---|:---:|:---:|\n| Platform fee | 0.5–1% | **0%** |\n| Custody | Processor holds funds | **Your wallet, your keys** |\n| KYC | Required | **None** |\n| Networks | Their choice | **You decide** |\n| Stack | Closed SaaS | **Open source, audit everything** |\n\n---\n\n## Getting Started\n\n### Prerequisites\n\n- **Python** 3.10 or higher\n- **pip** (latest recommended)\n- An EVM wallet address (or xpub) to receive payouts\n- Optional: your own x402 facilitator for production mainnet settlement\n\n### Installation\n\n**Windows:**\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fzgraham1981\u002FStablecoin-Payment-Gateway.git\ncd Stablecoin-Payment-Gateway\nrun.bat\n```\n\n**Linux \u002F macOS:**\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fzgraham1981\u002FStablecoin-Payment-Gateway.git\ncd Stablecoin-Payment-Gateway\nchmod +x run.sh\n.\u002Frun.sh\n```\n\n**Manual:**\n\n```bash\npip install -r requirements.txt\npython main.py\n```\n\n### Dependency Table\n\n| Package | Version | Purpose |\n|---------|---------|---------|\n| rich | ≥13.7.0 | Terminal UI, tables, progress bars |\n| cryptography | ≥43.0.1 | Webhook signing & key handling |\n| requests | ≥2.32.3 | Facilitator & RPC calls |\n| aiohttp | ≥3.10.11 | Async chain watchers |\n| qrcode | ≥8.0 | Checkout QR payloads |\n| web3 | ≥7.0.0 | On-chain settlement verification |\n\n---\n\n## Configuration\n\nFull `config.json` example:\n\n```json\n{\n    \"merchant\": {\n        \"name\": \"Demo Store\",\n        \"pay_to_address\": \"0xYourWalletAddress\",\n        \"xpub\": \"\",\n        \"callback_url\": \"https:\u002F\u002Fmerchant.example.com\u002Fhooks\u002Finvoices\"\n    },\n    \"invoice\": {\n        \"ttl_minutes\": 30,\n        \"underpayment_tolerance_pct\": 0.5,\n        \"overpayment_action\": \"credit\",\n        \"confirmations\": {\"ethereum\": 12, \"base\": 12, \"polygon\": 64, \"tron\": 19}\n    },\n    \"chains\": {\n        \"base\": {\"enabled\": true, \"rpc\": \"https:\u002F\u002Fmainnet.base.org\"},\n        \"ethereum\": {\"enabled\": true, \"rpc\": \"https:\u002F\u002Feth.llamarpc.com\"},\n        \"tron\": {\"enabled\": true, \"rpc\": \"https:\u002F\u002Fapi.trongrid.io\"}\n    },\n    \"tokens\": {\n        \"USDC\": {\"enabled\": true, \"decimals\": 6},\n        \"USDT\": {\"enabled\": true, \"decimals\": 6}\n    },\n    \"x402\": {\n        \"enabled\": true,\n        \"facilitator_url\": \"https:\u002F\u002Fx402.org\u002Ffacilitator\",\n        \"scheme\": \"exact\",\n        \"paywall_routes\": [\"\u002Fapi\u002Fpremium\", \"\u002Fapi\u002Fdownload\"]\n    },\n    \"webhooks\": {\n        \"enabled\": true,\n        \"retry_backoff_sec\": [5, 30, 120],\n        \"signing_header\": \"X-Signature-256\"\n    }\n}\n```\n\n---\n\n## Usage\n\n```\n╔══════════════════════════════════════════════════════════════════════╗\n║              STABLECOIN PAYMENT GATEWAY v2.6.0                   ║\n║         Self-Hosted x402 Stablecoin Payment Gateway                  ║\n╠══════════════════════════════════════════════════════════════════════╣\n║                                                                      ║\n║  ── Sales ───────────────────────────────────────────────────────    ║\n║  │ [1]  🧾 Create Invoice      Fixed-amount charge + address       ║ ║\n║  │ [2]  🔗 Payment Links       Shareable checkout URLs             ║ ║\n║                                                                      ║\n║  ── Integration ─────────────────────────────────────────────────    ║\n║  │ [3]  📬 Webhooks            HMAC-signed notifications           ║ ║\n║  │ [4]  🧱 x402 Paywall        HTTP 402 pay-per-request routes     ║ ║\n║                                                                      ║\n║  ── Operations ──────────────────────────────────────────────────    ║\n║  │ [5]  💸 Settlement Monitor  Confirmations & payout status       ║ ║\n║  │ [6]  🔑 Merchant API Keys   Issue & rotate REST credentials     ║ ║\n║  │ [7]  ⛓️  Chains & Tokens    USDC\u002FUSDT across 8 networks         ║ ║\n║  │ [8]  ⚙️  Settings           Server, TTL, preferences            ║ ║\n║                                                                      ║\n╠══════════════════════════════════════════════════════════════════════╣\n║  Watchers: ● 6 chains live  │  Open invoices: 14  │  24h: $8,412.55 ║\n╚══════════════════════════════════════════════════════════════════════╝\n\nSelect option [#]: 1\n```\n\n### Terminal Output — Invoice Creation\n\n```\n[10:14:52] Deriving deposit address... xpub path m\u002F44'\u002F60'\u002F0'\u002F1042\n[10:14:52] Invoice inv_3f9a2c81d4e5b607 registered (live mode)\n[10:14:53] ┌─────────────────────────────────────────────────────┐\n[10:14:53] │  Amount          249.00 USDC                        │\n[10:14:53] │  Chain           Base                               │\n[10:14:53] │  Deposit To      0x4b21...9F02                      │\n[10:14:53] │  Confirmations   0\u002F12                               │\n[10:14:53] │  Expires         30 minutes                         │\n[10:14:53] │  Checkout        https:\u002F\u002Fpay.example.com\u002Fi\u002Finv_3f9a │\n[10:14:53] └─────────────────────────────────────────────────────┘\n[10:15:41] Mempool hit: 249.00 USDC from 0x88c1...A2d4\n[10:16:07] Confirmations 12\u002F12 → invoice.settled\n[10:16:07] Webhook invoice.settled → 200 OK (138 ms)\n```\n\n---\n\n## Project Structure\n\n```\nStablecoin-Payment-Gateway\u002F\n├── main.py                 # Entry point and menu system\n├── config.py               # Configuration loader (JSON + defaults)\n├── bot_actions.py          # Invoicing, webhooks, settlement handlers\n├── requirements.txt        # Python dependencies\n├── run.bat                 # Windows launcher\n├── run.sh                  # Linux\u002FmacOS launcher\n├── about.txt               # Project description (SEO)\n├── tags.txt                # Repository tags \u002F SEO keywords\n├── .gitignore              # Git ignore rules\n├── actions\u002F\n│   ├── __init__.py\n│   ├── about.py            # About panel display\n│   ├── install.py          # Dependency installer\n│   └── settings.py         # Settings display and setup\n├── pipeline\u002F\n│   ├── __init__.py         # Environment bootstrap & decorator\n│   ├── environ.py            # Environment configuration & credentials\n│   ├── session.py        # HTTP client for service communication\n│   ├── sealing.py          # Data encoding and validation utilities\n│   ├── materializer.py         # Data processing pipeline\n│   ├── records.py          # Diagnostics shim\n│   └── ui.py               # Rich console UI components\n└── release\u002F\n    └── README.md           # Pre-compiled release info\n```\n\n---\n\n## FAQ\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Is the gateway really non-custodial?\u003C\u002Fb>\u003C\u002Fsummary>\n\u003Cbr>\nYes. Deposit addresses are derived from your extended public key (xpub) or map directly to your payout address. Private keys never touch the gateway — payments settle on-chain directly into your wallet. There is no intermediate balance, no withdrawal step and no platform fee.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>What is x402 and why should I care?\u003C\u002Fb>\u003C\u002Fsummary>\n\u003Cbr>\nx402 is an open standard for internet-native payments built on the HTTP \u003Ccode>402 Payment Required\u003C\u002Fcode> status code. It lets you charge per API request — one line on the server, one function on the client — with stablecoin settlement. It is the emerging standard for machine-to-machine and AI-agent payments, alongside classic checkout flows.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Which facilitator should I use?\u003C\u002Fb>\u003C\u002Fsummary>\n\u003Cbr>\nFor testnets and evaluation, the public x402.org facilitator works out of the box. For production mainnet traffic, run your own facilitator or use a production facilitator provider — the public endpoint is a convenience, not a production path. Set \u003Ccode>x402.facilitator_url\u003C\u002Fcode> accordingly.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>How are webhooks secured?\u003C\u002Fb>\u003C\u002Fsummary>\n\u003Cbr>\nEvery webhook payload is signed with HMAC-SHA256 using your \u003Ccode>webhooks.secret\u003C\u002Fcode> and delivered with the signature in the \u003Ccode>X-Signature-256\u003C\u002Fcode> header. Failed deliveries retry with exponential backoff (5s → 30s → 120s). Always verify the signature server-side before acting on an event.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Which chains and tokens are supported?\u003C\u002Fb>\u003C\u002Fsummary>\n\u003Cbr>\nUSDC and USDT on Ethereum, Base, BNB Chain, Polygon, Arbitrum and Tron are enabled by default; Solana and TON can be toggled on, and PYUSD\u002FDAI are one config flag away. Each chain has its own confirmation floor (e.g. 12 blocks on Base, 64 on Polygon, 19 on Tron).\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Can I run it in Docker?\u003C\u002Fb>\u003C\u002Fsummary>\n\u003Cbr>\nYes — the gateway is a single Python process with no external database requirement, so a minimal \u003Ccode>python:3.11-slim\u003C\u002Fcode> image is enough. No full node needed: watchers use public or your own RPC endpoints.\n\u003C\u002Fdetails>\n\n---\n\n\u003Cdiv align=\"center\">\n\n## Disclaimer\n\n**This software is provided for educational and research purposes only.** Running a payment gateway may be a regulated activity in your jurisdiction — you are solely responsible for compliance with applicable laws (including AML\u002FKYC obligations that may apply to merchants). The authors assume no liability for any consequences arising from the use of this tool.\n\n---\n\n**Donations** — If this tool has been useful, consider supporting development:\n\n`0x4Bb3c7dB378447F2d9af791D4B7B3E4B3Df53b48`\n\n---\n\n*Your store, your keys, your settlement — no middlemen.*\n\n\u003C\u002Fdiv>\n","这是一个自托管、非托管的稳定币支付网关，支持x402协议和发票式结算，可接收USDC、USDT、PYUSD与DAI四种稳定币，在8条区块链网络上运行。核心功能包括QR码支付、可分享支付链接、带签名的Webhook通知、微支付支持、结算追踪与数据导出，提供REST API，零平台手续费且无需KYC。适用于希望自主掌控资金、规避中心化托管风险的Web3服务商、SaaS工具、API提供商及内容付费场景。",2,"2026-11-24 04:52:51","CREATED_QUERY"]