Drop-in middleware that donates a fraction of a cent in USDC to charity every time a user takes an action — powered by the x402 payment protocol.
Deploy your own x402 charity server. Your users never need a wallet — your company funds the donations.
You deploy an x402 charity server, fund it with USDC, and point it at your chosen charity. Your product server triggers donations with a simple POST request.
Jump over obstacles to donate $0.001 USDC for each one cleared. No wallet needed — the server pays via x402.
Create a wallet, deploy the server, and trigger donations from your product.
# Create a new wallet to fund donations.
# Use any wallet provider (MetaMask, Coinbase Wallet, etc.)
# and export the private key.
# You'll need 3 env vars:
DONATION_PRIVATE_KEY="0xabc..." # your new wallet's private key
CHARITY_WALLET="0xdef..." # the charity's wallet address
CHARITY_NAME="Give Directly" # display name for the charity
# Then fund the donation wallet with:
# • USDC on Base (for donations)
# • A small amount of ETH on Base (for gas)
# Clone and build with Docker
$ git clone https://github.com/allscale-io/x402charity.git
$ cd x402charity
$ docker build -t x402charity .
# Run with your env vars
$ docker run -p 3402:3402 \
-e DONATION_PRIVATE_KEY="0xabc..." \
-e CHARITY_WALLET="0xdef..." \
-e CHARITY_NAME="Give Directly" \
-e DONATION_NETWORK="base" \
x402charity
# Your server is live at http://localhost:3402
# Dashboard is built into the landing page
// From your product server — any language, any framework.
// Call POST /donate whenever a user action should trigger a donation.
const res = await fetch('https://your-charity-server.com/donate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ amount: '$0.001' }),
});
const receipt = await res.json();
console.log(receipt.txHash); // on-chain tx proof
// GET /donations returns JSON history of all donations
Any user action can become a micro-donation. Here are a few examples — and why it's good for your business.
Donate a fraction of a cent on every swap or trade. 50K daily trades = $50/day to charity.
Attach a micro-donation to every API call or prompt. High-volume APIs add up fast.
Every level cleared, match played, or in-game action triggers a small donation.
Round up every checkout or donate per order. Customers love brands that give back.
Donate on every bet placed or market resolved. Turn speculation into impact.
Micro-donate on every transfer, bill payment, or card swipe processed by your platform.
All donations are on-chain and publicly verifiable on Base.