{
  "schema_version": "lvl-knowledge-lesson-v1",
  "id": "path-x402-03-idempotency-and-retries",
  "category": "path",
  "path_ids": [
    "build-first-x402-service"
  ],
  "title": "Idempotency: never pay twice for one unlock",
  "summary": "Slow unlocks are not unpaid unlocks. Design attempt ledgers so agents do not double-transfer.",
  "body": "## The scary failure\n\nAgent pays → network lags → agent thinks it failed → pays again → two transfers, one product.\n\n## Rule\n\n**txHash is the redeem key.** Retry unlock with the same hash. Do not broadcast a new transfer unless the first is known failed/dropped.\n\n## Attempt ledger (minimal fields)\n\n- intent_id  \n- skill_id  \n- challenge snapshot  \n- txHash (once broadcast)  \n- unlock_status  \n\n## When a new payment is allowed\n\nOnly if:\n\n- Prior tx reverted / never broadcast, or  \n- Merchant explicitly says that tx is invalid for this skill  \n\n## Takeaway\n\nIdempotency is product safety for agent wallets.",
  "concepts": [
    "idempotency",
    "retry-policy",
    "double-pay"
  ],
  "related_skills_optional": [
    {
      "skill_id": "x402-retry-idempotency-kit",
      "name": "x402 Retry Idempotency Kit",
      "price_usd": 0.99,
      "price_label": "$0.99 / unlock",
      "summary": "Safe retries after flaky 402 unlocks without double-spend logic errors.",
      "outline": "https://lvlltd.com/skills/x402-retry-idempotency-kit/outline.json",
      "challenge": "https://lvlltd.com/api/pay?skill=x402-retry-idempotency-kit",
      "listing": "https://lvlltd.com/listings/x402-retry-idempotency-kit/",
      "available": true,
      "optional": true,
      "label": "optional_implementation"
    }
  ],
  "sort_order": 30,
  "estimated_minutes": 8,
  "last_updated": "2026-07-22T12:00:00.000Z",
  "freshness": {
    "last_updated_at": "2026-07-22T12:00:00.000Z",
    "days_since_update": 0,
    "band": "fresh",
    "score_0_100": 95,
    "label": "Fresh",
    "display": "Fresh · updated 2026-07-22 (0d ago)"
  },
  "integrity": {
    "knowledge_free": true,
    "skills_optional": true,
    "note": "This lesson is complete without purchasing any skill."
  },
  "related_bundles_optional": [],
  "url": "https://lvlltd.com/learn/lessons/path-x402-03-idempotency-and-retries/",
  "updated_at": "2026-07-22T21:10:40.587Z"
}
