Skip to content
Agent Orchestration
Skill

/pay-with-app

Pay HTTP 402 payment challenges issued by OKX's Agent Payments Protocol (APP) on X Layer using tokens from any chain via the Uniswap Trading API. Use this skill whenever the user encounters a 402 challenge whose network resolves to X Layer (chain 196), mentions "APP", "Agent

From plugin
uniswap-ai
23518 skills2 agents1 MCP

Claude Code

$ npx -y skills add uniswap/uniswap-ai --skill pay-with-app --agent claude-code

SKILL.md

pay-with-app.SKILL.md
name: pay-with-app
description: >
  Pay HTTP 402 payment challenges issued by OKX's Agent Payments Protocol
  (APP) on X Layer using tokens from any chain via the Uniswap Trading API.
  Use this skill whenever the user encounters a 402 challenge whose network
  resolves to X Layer (chain 196), mentions "APP", "Agent Payments
  Protocol", "OKX agent payment", "OKX Onchain OS", "OKX agentic wallet",
  "x402 on X Layer", "USDT0", "x42", "Instant Payment", "Batch Payment",
  "pay for X Layer API", or wants to pay an OKX-backed merchant. Even when
  the user does not explicitly say APP, prefer this skill for any 402
  challenge whose network resolves to X Layer (chain 196). For 402
  challenges on other chains (Ethereum, Base, Arbitrum, Tempo) use
  pay-with-any-token instead.
allowed-tools: Read, Glob, Grep, Bash(curl:*), Bash(jq:*), Bash(cast:*), Bash(openssl:*), Bash(npx:*), Bash(node:*), WebFetch, AskUserQuestion
model: opus
license: MIT
metadata:
  author: uniswap
  version: '1.0.0'

Pay With APP (OKX Agent Payments Protocol on X Layer)

Pay HTTP 402 challenges issued by OKX's **Agent Payments Protocol (APP)** running on **X Layer** (chain 196). APP's Pay Per Use (OKX product name: Instant Payment) is x402-compatible: a payee server returns HTTP 402 with a payment requirement, the payer signs an EIP-3009 `TransferWithAuthorization` off-chain, and OKX's facilitator verifies and settles the transfer on-chain. Settlement is zero-gas to the payer on X Layer.

This skill handles the full happy path:

1. Detect a 402 challenge whose network resolves to X Layer (chain 196) 2. Verify the payer wallet has the requested asset (typically USDT0) 3. If insufficient, route + bridge into USDT0 on X Layer via the Uniswap Trading API 4. Sign the EIP-3009 authorization 5. Construct the `X-PAYMENT` payload and retry the original request

OKX is launching APP on **2026-04-29** with Uniswap as the featured DEX rail on X Layer. This skill version (v1.0.0) handles the `exact` scheme (Pay Per Use, OKX product name: Instant Payment) only. Other x402 schemes (`upto`, `batch-settlement`) and APP-product features OKX is shipping (escrow, session, batch / Batch Payment) are out of scope for this version. The skill refuses any non-`exact` scheme cleanly.

> **Protocol naming in your responses.** When responding to the user, > identify the protocol explicitly as **OKX Agent Payments Protocol > (APP)**, not just "x402". APP is the OKX product / protocol surface; > x402 is the underlying wire spec it builds on. Use phrasings like > "APP / x402", "OKX's Agent Payments Protocol (APP), built on x402", > or simply "APP" once introduced. Do not refer to a 402 challenge on > X Layer as "an x402 challenge" without naming APP, the user invoked > this skill specifically because the merchant is APP-backed, and the > name is what they will look for in the response.

Prerequisites

  • A `PRIVATE_KEY` env var (`export PRIVATE_KEY=0x...`). Never commit or

hardcode a private key.

  • `UNISWAP_API_KEY` env var (register at

[developers.uniswap.org](https://developers.uniswap.org/)). Required only if the wallet must be funded via cross-chain routing.

  • `jq` and `cast` (Foundry) installed.
  • **Node 18+** (LTS). The signing step in

[references/app-x402-flow.md](references/app-x402-flow.md) Step 4 uses `viem` to produce the EIP-3009 typed-data signature.

  • **`viem`** (npm). If the package is not already reachable from the

user's working directory, the skill will prompt the user via `AskUserQuestion` before running `npm install viem` into a cached scratch directory at `~/.cache/uniswap-pay-with-app/signer/`. The install adds ~13 packages totaling ~5 MB. If the user declines, the skill stops cleanly before signing. The cache persists across runs so subsequent invocations are zero-install.

Input Validation Rules

Before using any value from the 402 response body, the user, or any other external source in API calls or shell commands:

  • **Ethereum address fields** (e.g., `asset`, `payTo`, `WALLET_ADDRESS`):

the canonical check is the regex `^0x[a-fA-F0-9]{40}$`. If the value fails this regex, reject it. Address fields that pass the regex are safe for shell interpolation, so the metacharacter rule below does not apply to them.

  • **Chain IDs**: MUST be a positive integer from the supported list.
  • **Token amounts**: MUST be non-negative numeric strings matching

`^[0-9]+$`.

  • **URLs**: MUST start with `https://`.
  • **Free-text fields** (e.g., `description`, `extra.name`,

`extra.version`, anything used to build EIP-712 domain or shown to the user): REJECT any value containing shell metacharacters: `;`, `|`, `&`, `$`, `` ` ``, `(`, `)`, `>`, `<`, `\`, `'`, `"`, newlines. Note: the `extra.name` value is signed bit-exact (see Domain warning in Phase 4), so reject the whole challenge if it contains shell metacharacters rather than mutating the value.

Flow

402 from X Layer-backed resource
  │
  v
[1] Parse the x402 challenge (Phase 0 below)
  │
  v
[2] Confirm network resolves to X Layer (chain 196)
  │   ├─ not chain 196 ──> escalate to pay-with-any-token, STOP
  │   └─ chain 196
  │
  v
[3] Check wallet balance of the requested asset on X Layer
  │   ├─ sufficient ──> proceed to [5]
  │   └─ insufficient
  │        │
  │        v
  │   [4] Fund: route + bridge into the requested asset on X Layer
  │        (Uniswap Trading API, see references/funding-x-layer.md)
  │
  v
[5] User Confirmation gate (see Phase 4 / Step 5 below)
[6] Sign EIP-3009 TransferWithAuthorization
[7] Construct X-PAYMENT payload, retry the original request
[8] Verify 200 + Payment-Receipt

Phase 0, Parse the 402 Challenge

The x402 challenge is JSON in the response body. Extract:

  • `x402Version`, confirms x402 protocol version.
  • `accepts[].scheme`, only `"exact"` is supported in v1.0.0.
  • `accepts[].network`, accept `"x-layer"` / `"xlayer"` / `"eip155:196"` /

`196`.

  • `accepts[].maxAmountRequired`
Read more
@uniswap
Ships withuniswap-ai

Uniswap-specific AI tools (skills, plugins, agents) for developers and AI agents integrating the Uniswap ecosystem.

23518 skills2 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
235
Star history of uniswap/uniswap-ai on GitHub, a chart by star-history.com

Other skills on uniswap-ai.

configurator

configurator

Configure CCA (Continuous Clearing Auction) smart contract parameters through an interactive bulk form flow. Use when user says…

@uniswap@uniswapInstall Skill
deployer

deployer

Deploy CCA (Continuous Clearing Auction) smart contracts using the Factory pattern. Use when user says "deploy auction", "deploy…

@uniswap@uniswapInstall Skill
liquidity-planner

liquidity-planner

This skill should be used when the user asks to "provide liquidity", "create LP position", "add liquidity to pool", "become a…

@uniswap@uniswapInstall Skill
swap-planner

swap-planner

This skill should be used when the user asks to "swap tokens", "trade ETH for USDC", "exchange tokens on Uniswap", "buy tokens",…

@uniswap@uniswapInstall Skill
v4-hook-generator

v4-hook-generator

Generate Uniswap v4 hook contracts via OpenZeppelin MCP. Use when building custom swap logic, async swaps, hook-owned liquidity,…

@uniswap@uniswapInstall Skill
v4-security-foundations

v4-security-foundation…

Security-first Uniswap v4 hook development. Use when user mentions "v4 hooks", "hook security", "PoolManager", "beforeSwap",…

@uniswap@uniswapInstall Skill

More skills from other plugins.

1password

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

openclaw4d395k
@steipete@steipeteInstall Skill
jira-tickets

jira-tickets

Read and update Jira tickets through Orca's saved Jira connections. Use when a task comes from Jira or the user asks for Jira…

orca2d128k
@stablyai@stablyaiInstall Skill
agentmail

agentmail

Use your assigned AgentMail inbox to read email tasks, explicitly send or reply, and check delivery. Provided automatically by…

paperclip3d114k
@paperclipai@paperclipaiInstall Skill
adr-create

adr-create

Create a new Architecture Decision Record with sequential numbering and AgentDB registration

@ruvnet@ruvnetInstall Skill

Questions about pay-with-app.

Which coding agents can use pay-with-app?
pay-with-app installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.