iautopay

ClawSkills 作者 newblock v0.1.1

Purchase API keys from iAutoPay Fact API using USDC on Base chain. Use this skill when: - Buying API keys for AI agent payment services - Managing API key subscriptions (1/7/30 days) - Checking user account information and usage statistics - Checking server information and pricing - Integrating crypto payments for API access

源码 ↗

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install clawskills:newblock~iautopay
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/clawskills%3Anewblock~iautopay/file -o iautopay.md
Git 仓库获取源码
git clone https://github.com/openclaw/skills/commit/d2f2206dc15a8d6c2bd5da9af11ed21635112822
# iAutoPay Fact API

Base URLs:
- **fact-api**: `https://apipaymcp.okart.fun` (Payment API)
- **napi-ser**: `http://ipaynapi.gpuart.cn` (User Management & API Keys)

## Network Configuration

- **Chain**: Base Sepolia (Testnet)
- **Chain ID**: eip155:84532
- **Asset**: `0x036CbD53842c5426634e7929541eC2318f3dCF7e` (USDC)
- **Payee**: `0x1a85156c2943b63febeee7883bd84a7d1cf0da0c`

## Pricing

| Duration | Price (USDC) |
|----------|--------------|
| 1 day    | 0.09         |
| 7 days   | 0.49         |
| 30 days  | 0.99         |

## Endpoints

### fact-api (Payment Service)

### GET /info - Server Information

Get current server status, pricing, and configuration.

```bash
curl "https://apipaymcp.okart.fun/info"
```

**Response:**
```json
{
  "name": "iAutoPay Fact API",
  "version": "0.1.0",
  "environment": "dev",
  "network": "eip155:84532",
  "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
  "prices": {
    "1day": "90000",
    "1dayUsdc": 0.09,
    "7days": "490000",
    "7daysUsdc": 0.49,
    "30days": "990000",
    "30daysUsdc": 0.99
  },
  "payee": "0x1a85156c2943b63febeee7883bd84a7d1cf0da0c",
  "bypassPayment": false,
  "paymentScheme": "exact"
}
```

### POST /v1/buy-apikey - Purchase API Key

Buy an API key with specified duration. Payment is handled via EIP-3009 signed payment in the request header.

```bash
curl -X POST "https://apipaymcp.okart.fun/v1/buy-apikey" \
  -H "Content-Type: application/json" \
  -H "PAYMENT-SIGNATURE: '{\"from\":\"0x...\",\"to\":\"0x...\",\"value\":\"90000\",\"validAfter\":\"0\",\"validBefore\":\"1738368000\",\"nonce\":\"0x...\",\"v\":27,\"r\":\"0x...\",\"s\":\"0x...\"}'" \
  -d '{"duration": 7}'
```

**Request Body:**
```json
{
  "duration": 7
}
```

**Headers:**
| Header | Type | Required | Description |
|--------|------|----------|-------------|
| Content-Type | string | Yes | "application/json" |
| PAYMENT-SIGNATURE | string | Yes | EIP-3009 signed payment payload (JSON string) |

**PAYMENT-SIGNATURE Payload:**
```json
{
  "from": "0x1234567890abcdef1234567890abcdef12345678",
  "to": "0x1a85156c2943b63febeee7883bd84a7d1cf0da0c",
  "value": "490000",
  "validAfter": "0",
  "validBefore": "1738368000",
  "nonce": "0xabc123...",
  "v": 27,
  "r": "0x...",
  "s": "0x..."
}
```

**Duration Options:**
| Value | Duration | Price |
|-------|----------|-------|
| 1     | 1 day    | 0.09 USDC |
| 7     | 7 days   | 0.49 USDC |
| 30    | 30 days  | 0.99 USDC |

**Response:**
```json
{
  "apiKey": "sk-7ac3d7c8fed74b0a8ae8f949e017e9f5",
  "txHash": "0x1f62f45e5ae6e8cd637048d0f099d324f749f61d35906ffe481e36e92689769b",
  "payState": "paid",
  "durationDays": 7,
  "transactionId": "ed66d250-7353-473d-bc73-0bd7541f40c0"
}
```

**Response Fields:**
| Field | Type | Description |
|-------|------|-------------|
| apiKey | string | Your API key (use this for authentication) |
| txHash | string | Blockchain transaction hash |
| payState | string | Payment status ("paid") |
| durationDays | number | API key duration in days |
| transactionId | string | Unique transaction ID |

### POST /v1/transfer - Pay Stablecoin

Pay USDC to any address using EIP-3009 off-chain signature.

### GET /user/me - Get User Information

Get your user account information, API keys, and usage statistics. **Requires authentication with your API key.**

```bash
curl "http://ipaynapi.gpuart.cn/user/me" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

**Response:**
```json
{
  "success": true,
  "data": {
    "user": {
      "id": "user_xxx",
      "walletAddress": "0x1234567890abcdef1234567890abcdef12345678",
      "createdAt": 1772072451317,
      "lastPurchasedAt": 1772072457962,
      "status": "active",
      "totalPurchases": 2
    },
    "activeApiKeys": 2,
    "totalSpent": 1480000,
    "apiKeys": [
      {
        "apiKey": "sk-xxx",
        "durationDays": 7,
        "createdAt": "2026-02-26T02:01:12.904Z",
        "expiresAt": "2026-03-05T02:01:12.904Z",
        "status": "active"
      }
    ],
    "recentTransactions": [...]
  }
}
```

**Note**: The first purchase automatically creates your user account. No separate registration is required!

### GET /user/my-keys - List User API Keys

Get all API keys for your user account. **Requires authentication with your API key.**

```bash
curl "http://ipaynapi.gpuart.cn/user/my-keys" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

**Response:**
```json
{
  "success": true,
  "count": 2,
  "data": [
    {
      "apiKey": "sk-xxx",
      "durationDays": 7,
      "createdAt": "2026-02-26T02:01:12.904Z",
      "expiresAt": "2026-03-05T02:01:12.904Z",
      "status": "active"
    }
  ]
}
```

### POST /v1/transfer - Pay Stablecoin

Pay USDC to any address using EIP-3009 off-chain signature.

```bash
curl -X POST "https://apipaymcp.okart.fun/v1/transfer" \
  -H "Content-Type: application/json" \
  -H "PAYMENT-SIGNATURE: '{\"from\":\"0x...\",\"to\":\"0x...\",\"value\":\"10000\",\"validAfter\":\"0\",\"validBefore\":\"1738368000\",\"nonce\":\"0x...\",\"v\":27,\"r\":\"0x...\",\"s\":\"0x...\"}'" \
  -d '{"to": "0x1234567890abcdef1234567890abcdef12345678", "amount": "10000", "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e"}'
```

**Request Body:**
```json
{
  "to": "0x1234567890abcdef1234567890abcdef12345678",
  "amount": "10000",
  "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
}
```

**Parameters:**
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| to | string | Yes | Recipient wallet address |
| amount | string | Yes | Amount in smallest unit (10000 = 0.01 USDC) |
| asset | string | Yes | Token contract address (USDC on Base Sepolia) |

**Headers:**
| Header | Type | Required | Description |
|--------|------|----------|-------------|
| Content-Type | string | Yes | "application/json" |
| PAYMENT-SIGNATURE | string | Yes | EIP-3009 signed payment payload (JSON string) |

**Response:**
```json
{
  "success": true,
  "transactionHash": "0x1234567890abcdef...",
  "from": "0xabcdef1234567890abcdef1234567890abcdef12",
  "to": "0x1234567890abcdef1234567890abcdef12345678",
  "amount": "0.010000",
  "deductedAmount": "0.010000 USDC",
  "currentBalance": "9.990000 USDC"
}
```

## User Management (New Feature)

The iAutoPay system now includes **automatic user registration**. When you purchase an API key for the first time, a user account is automatically created and linked to your wallet address.

### Auto-Registration Flow

1. **First Purchase**: Call `/v1/buy-apikey` with your signed payment
2. **Auto-Create User**: System automatically creates user account
3. **API Key Assigned**: API key is linked to your user account
4. **User Info Available**: Use `/user/me` to view account details

No separate registration step is required!

### User Endpoints

#### GET /user/me - Get User Information

Get your user account information, API keys, and usage statistics.

```bash
curl "http://ipaynapi.gpuart.cn/user/me" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

**Response:**
```json
{
  "success": true,
  "data": {
    "user": {
      "id": "user_xxx",
      "walletAddress": "0x1234567890abcdef1234567890abcdef12345678",
      "createdAt": 1772072451317,
      "lastPurchasedAt": 1772072457962,
      "status": "active",
      "totalPurchases": 2
    },
    "activeApiKeys": 2,
    "totalSpent": 1480000,
    "apiKeys": [
      {
        "apiKey": "sk-xxx",
        "durationDays": 7,
        "createdAt": "2026-02-26T02:01:12.904Z",
        "expiresAt": "2026-03-05T02:01:12.904Z",
        "status": "active"
      }
    ],
    "recentTransactions": [...]
  }
}
```

#### GET /user/my-keys - List User API Keys

Get all API keys for your user account.

```bash
curl "http://ipaynapi.gpuart.cn/user/my-keys" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

**Response:**
```json
{
  "success": true,
  "count": 2,
  "data": [
    {
      "apiKey": "sk-xxx",
      "durationDays": 7,
      "createdAt": "2026-02-26T02:01:12.904Z",
      "expiresAt": "2026-03-05T02:01:12.904Z",