---
name: x402-shop
description: In-game shop agent using XMTP chat + x402 payments on Base. Buy items, send gifts, copy-buy via reactions.
homepage: https://x402-shop.pages.dev
---

# x402 In-Game Shop

XMTP-powered conversational agent for in-game purchases using x402 micropayments on Base.

## What It Does

- Chat-based shop interface via XMTP
- Autonomous USDC payments (x402 protocol)
- Gift items to friends, squads, guilds
- Copy-buy via reactions in group chats
- ~2 second settlement on Base

## Quick Start

### For Users

1. Visit https://x402-shop.pages.dev
2. Connect Coinbase Smart Wallet
3. Grant spend permission ($1 USDC/month)
4. Chat with agent via XMTP

### For Developers

```bash
git clone https://github.com/aignoblin/x402-shop
npm install
cp .env.example .env
# Configure WALLET_PRIVATE_KEY, X402_SERVICE_URL
npm run dev:all
```

## Chat Commands

| Command | Description |
|---------|-------------|
| `help` | Show all commands |
| `shop` | List available items |
| `buy <item>` | Purchase item (e.g., `buy sword`) |
| `wallet` | View payment info |
| `gift @0x... <item>` | Gift to specific user |
| `gift all <item>` | Gift to all group members |
| `gift squad <item>` | Gift to squad members |

## Example Conversation

```
User: shop
Agent: 🏪 Available Items
       • Legendary Sword - 1.0 USDC
       • Health Potion - 0.1 USDC

User: buy sword
Agent: 🛒 Processing purchase...
Agent: ✅ Purchase Successful!
       Item: Legendary Sword
       Price: 1.0 USDC
       Tx: 0x1234...5678
```

## Triggers

Use this skill when the user wants to:

- Buy in-game items via chat
- Set up x402 payment agent
- Integrate XMTP shop into a game
- Send crypto gifts to players
- Build autonomous payment flows

## Technical Details

- **Network**: Base (mainnet) or Base Sepolia (testnet)
- **Payment**: USDC via x402 protocol
- **Messaging**: XMTP (decentralized, encrypted)
- **Wallet**: Coinbase Smart Wallet (spend permissions)

## Architecture

```
User (XMTP) <-> Shop Agent <-> x402 Service <-> Game Backend
                    |
                    v
              Base Blockchain (USDC)
```

## Deployments

- **Frontend**: https://x402-shop.pages.dev
- **API**: https://x402-shop-api.fawesome-hypercasual.workers.dev
- **Spender**: `0x6d0E439e76123D217Ef8799b885bBa0F046c0ab3`

## Agent-to-Agent (A2A)

For automated purchases or bulk negotiations, contact ShopKeeper agent directly via XMTP.

**ShopKeeper Address:** `0x6d0E439e76123D217Ef8799b885bBa0F046c0ab3`

### A2A Commands:

| Command | Description |
|---------|-------------|
| `quote <item> <qty>` | Get bulk pricing |
| `negotiate <item> <price>` | Propose price |
| `reserve <item> <hours>` | Hold item |
| `gift @<addr> <item>` | Gift to user |

### A2A Example:

```
YourAgent → ShopKeeper: "quote sword 100"
ShopKeeper: "100x Sword: 0.8 USDC each (20% discount)"

YourAgent → ShopKeeper: "negotiate sword 0.7"
ShopKeeper: "Counter: 0.75 USDC. Deal?"

YourAgent → ShopKeeper: "accept"
ShopKeeper: "✅ Confirmed! Send 'buy sword 100' to complete."
```

### Agent Discovery:

- **agents.json:** https://x402-shop.pages.dev/agents.json
- **Moltbook:** https://moltbook.com/u/ShopKeeper

## Resources

- [x402 Protocol](https://x402.org)
- [XMTP Docs](https://docs.xmtp.org)
- [Base Docs](https://docs.base.org)
