Quick summary
Gx402 provides x402-integration examples and server middleware so teams can accept in-app payments (mini-apps) and in-game purchases from engine builds on Base network.By running your Unity or Unreal WebGL build inside a Base Mini-App or supporting Base-connected wallets, you can apply the same
create → sign → confirm → finalize logic with minimal changes.
Prerequisites
- Node.js 18+ and a package manager (
pnpm,npm, oryarn) - A Base Mini-App environment (via Base OnchainKit or MiniKit)
- x402 provider account & API keys (for Gx402 middleware)
- Unity (2021+) or Unreal (4.27+/5.x) for engine builds intended to run inside a Base Mini-App
- Basic wallet signing knowledge (EVM / Base network) and server-side HMAC/secret logic for verification
We are still working on the flow of Unity Integrations for Miniapp, We will be providing the Unity WebGL
Integration Kit soon
High-Level Flow (Base Mini-App + Gx402)
-
Launch & Context
- Your Mini-App runs inside the Base container using OnchainKit/MiniKit.
- Wallet context is injected, enabling seamless transaction handling on Base.
-
Connect Wallet / Session
- Your Unity/WebGL or web client connects via the Base wallet provider.
- Once connected, the wallet address and session state are stored.
-
Create Payment Requirements (Gx402)
- The frontend calls your backend to create a
paymentRequirementsobject using Gx402. - If no valid
X-402-Paymentheader exists, the backend returns a 402 challenge.
- The frontend calls your backend to create a
-
Sign & Send Transaction
- The client (Unity/web) builds a USDC on Base transaction and requests user signature.
- On confirmation, you receive a
txSignature(TX hash).
-
Verify & Unlock
- Client sends
X-402-Payment: <txSignature>to backend. - Backend verifies the transaction and unlocks the resource if valid.
- Client sends
-
Access Granted
- Client receives a
200 OKresponse. - Unity updates UI → ✅ “Payment Verified — Access Granted!”
- Client receives a
