explaingit

glabun002/x402-unity-demo

Analysis updated 2026-05-18

0C#Audience · developerComplexity · 3/5Setup · moderate

TLDR

A demo where an AI agent autonomously pays testnet USDC to unlock an item inside a Unity game using the x402 payment protocol.

Mindmap

mindmap
  root((x402 demo))
    What it does
      Agent payment
      Unity item unlock
      Testnet USDC
    Tech stack
      C sharp
      Unity
      Node.js
      Express
    Use cases
      Protocol demo
      Agent commerce
      Prototype purchases
    Audience
      Game developers
      Agent builders

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

See a working example of an AI agent completing a machine-to-machine cryptocurrency payment.

USE CASE 2

Learn how the x402 payment protocol's request and settlement flow works end to end.

USE CASE 3

Prototype in-game purchases that an AI agent, rather than a human, initiates and pays for.

USE CASE 4

Study a minimal Unity client that polls a backend for purchase status changes.

What is it built with?

C#UnityNode.jsExpressUSDC

How does it compare?

glabun002/x402-unity-demoanulman/docx-saxatrblizzard/vtmb-sbox-mounter
Stars000
LanguageC#C#C#
Setup difficultymoderatemoderatemoderate
Complexity3/54/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Needs Node.js, Unity 6, and a wallet funded with free testnet USDC from a public faucet.

No license information was found in the README, so usage rights are unclear.

In plain English

This project is a small demo showing an AI agent buying an item inside a Unity video game on its own, without a human entering payment details. Instead of using a normal app store or payment processor, the game server responds to a purchase request with the plain web message that payment is required, and the AI agent replies by signing a payment using a cryptocurrency called USDC, sent over something called the x402 payment protocol. A neutral third party confirms the payment on the blockchain, and once that is done the game unlocks the item. The README is upfront about which parts are simplified for the demo: the money used is a test version of USDC on a test blockchain network, so it has no real value, the store only has one item and tracks who owns it in the server's memory rather than a real database, and the agent's decision to buy is scripted rather than genuinely decided by an AI model. What is not simplified is the actual payment mechanism itself: the payment request, the signed authorization, and the settlement step all use the real, unmodified protocol. To run the demo you need a recent version of Node.js and any version of Unity 6, plus a small amount of free test cryptocurrency for the agent's wallet, available from a public faucet website. You start a small server that acts as the store, start a separate small program that acts as the buying agent, then open the Unity project and press play. A sword shown in gray, meaning locked, turns gold once the agent's payment goes through, which the Unity scene checks for every two seconds. This is meant for developers curious about how AI agents might pay for things automatically inside games or apps, not for building a real store as is.

Copy-paste prompts

Prompt 1
Walk me through setting up the server, agent, and Unity project to run this demo locally.
Prompt 2
Explain how the x402 payment protocol's 402 Payment Required flow works in this codebase.
Prompt 3
Where do I get free testnet USDC on Base Sepolia to fund the agent's wallet for this demo?
Prompt 4
What parts of this demo are simplified stubs versus the real payment protocol?

Frequently asked questions

What is x402-unity-demo?

A demo where an AI agent autonomously pays testnet USDC to unlock an item inside a Unity game using the x402 payment protocol.

What language is x402-unity-demo written in?

Mainly C#. The stack also includes C#, Unity, Node.js.

What license does x402-unity-demo use?

No license information was found in the README, so usage rights are unclear.

How hard is x402-unity-demo to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is x402-unity-demo for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.