x402 Payment Gating Plugin — monetize any API with USDC micropayments #14871
plagtech
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
x402 Payment Gating Plugin — Turn any API into a paid API with USDC micropayments
Hey Kong community 👋
I built a JavaScript PDK plugin that adds x402 payment gating to any Kong route or service. One config, no code changes to your upstream APIs.
The problem: API monetization today means integrating billing platforms, managing API keys, and building subscription logic. For AI agents and machine-to-machine traffic, traditional auth-based billing doesn't work — agents need to pay per call, instantly, with no signup.
The solution: The x402 protocol (HTTP 402 Payment Required) lets clients pay for API access with USDC stablecoin micropayments. This plugin brings that to Kong.
How it works:
Configure per route:
That's it. Any request without a valid payment gets a 402 with everything the client needs to pay. Agents and clients that support x402 handle payment automatically.
Why this matters for Kong: Kong already has a Monetization plugin category. AI agent traffic is growing fast, and agents need a way to pay for API access without API keys or subscriptions. x402 is becoming the standard for this — Stripe recently added x402 support on Base. This plugin lets any Kong user tap into that.
Repo: https://github.com/plagtech/kong-plugin-x402
Docker quickstart included —
docker compose upand you have a working demo.Built with the JavaScript PDK. Payment verification routes through Spraay Protocol's x402 gateway (https://gateway.spraay.app). Would love feedback from the community, and happy to explore getting this on the Plugin Hub.
Beta Was this translation helpful? Give feedback.
All reactions