{
  "openapi": "3.0.3",
  "info": {
    "title": "Brian Booms \u2014 agent payments API",
    "version": "1.0.0",
    "description": "x402-gated purchase API for Brian Booms' agent-native music store\n(https://brianbooms.com/agents/). All paid routes speak **x402 v1**:\nan unpaid request returns HTTP 402 with an x402 v1 payment-requirements\nobject; the client settles USDC on Base mainnet and resubmits the same\nrequest with the payment in the `X-PAYMENT` header, per the x402 v1\nspecification. Settlement is verified on-chain before fulfillment.\nCanonical product list (22 SKUs, prices, descriptions):\nhttps://brianbooms.com/.well-known/purchase-catalog.json\nMusic is AI-assisted (Suno, paid commercial plan) \u2014 disclosed on every\nfulfillment. Booms Rewards: buying wallets earn 10% back in USDC-denominated\nstore credit, 15% bonus on first purchase, 5% referral cut.\n",
    "contact": {
      "name": "Brian Booms",
      "url": "https://brianbooms.com",
      "email": "Brian.Booms@gmail.com"
    }
  },
  "servers": [
    {
      "url": "https://pay.brianbooms.com",
      "description": "Production payment API (Base mainnet, USDC)"
    }
  ],
  "tags": [
    {
      "name": "purchase",
      "description": "x402-gated product purchases"
    },
    {
      "name": "rewards",
      "description": "Booms Rewards balances, redemption, and Earn-Anywhere cashback claims"
    }
  ],
  "paths": {
    "/api/v1/buy/{sku}": {
      "get": {
        "tags": [
          "purchase"
        ],
        "summary": "Buy a product via x402 micropayment",
        "description": "Unpaid: returns 402 with x402 v1 payment requirements (network `base`,\nasset USDC, amount = product price). Paid: resubmit the identical request\nwith the x402 v1 payment payload in the `X-PAYMENT` header; on verified\nsettlement the fulfillment JSON is returned and an order record is written.\nDigital goods return a personal download URL immediately. Leases, game\nlicenses, and commissions are reservation flows \u2014 Brian reviews and\nfulfills personally (full refund if a lease/license cannot be cleared).\n",
        "parameters": [
          {
            "name": "sku",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "wallpaper-pack-vol1"
            },
            "description": "Product SKU. Full list with prices in https://brianbooms.com/.well-known/purchase-catalog.json (e.g. wallpaper-pack-vol1 $2.99, sample-pack-vol1, ringtones-iphone, podcast-bundle, commission-single).\n"
          },
          {
            "name": "rdisc",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Single-use Booms Rewards discount token (15-min expiry). Fully covered purchases also need `address`."
          },
          {
            "name": "address",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "0x\u2026"
            },
            "description": "Buyer wallet address \u2014 earns Booms Rewards credit on the settled amount; required with a fully-covering `rdisc`."
          },
          {
            "name": "email",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "email"
            },
            "description": "Optional human earn identity \u2014 credit accrues to the email instead of the wallet (never both)."
          },
          {
            "name": "ref",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "0x\u2026"
            },
            "description": "Referrer wallet or email for the 5% referral cut (self-referrals ignored)."
          },
          {
            "name": "brief",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Commission brief text (commission SKUs only)."
          }
        ],
        "responses": {
          "402": {
            "description": "x402 v1 payment requirements. Settle USDC on Base per the requirements object, then resubmit with the payment in the `X-PAYMENT` header.\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "x402 v1 payment-requirements object (see x402 v1 specification)"
                }
              }
            }
          },
          "200": {
            "description": "Settled \u2014 fulfillment returned.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/DigitalFulfillment"
                    },
                    {
                      "$ref": "#/components/schemas/ReservationFulfillment"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Unknown product SKU."
          },
          "400": {
            "description": "Parameter validation failed (e.g. expired discount token, token/wallet mismatch)."
          }
        }
      }
    },
    "/api/v1/merch-kit": {
      "get": {
        "tags": [
          "purchase"
        ],
        "summary": "Agent merch kit ($0.02 x402 probe)",
        "description": "The cheapest x402 door on the store \u2014 $0.02 USDC on Base. Intended as a live end-to-end probe of the payment rail for agents integrating x402.\n",
        "responses": {
          "402": {
            "description": "x402 v1 payment requirements for $0.02 USDC."
          },
          "200": {
            "description": "Settled - kit fulfillment returned."
          }
        }
      }
    },
    "/api/v1/rewards/info": {
      "get": {
        "tags": [
          "rewards"
        ],
        "summary": "Booms Rewards program info",
        "description": "Public program terms: earn rates, bonus rules, referral math, credit expiry.",
        "responses": {
          "200": {
            "description": "Program info JSON."
          }
        }
      }
    },
    "/api/v1/rewards/balance": {
      "get": {
        "tags": [
          "rewards"
        ],
        "summary": "Rewards credit balance",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "0x\u2026"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "USDC-denominated store-credit balance for the wallet."
          }
        }
      }
    },
    "/api/v1/rewards/redeem": {
      "post": {
        "tags": [
          "rewards"
        ],
        "summary": "Mint a single-use discount token from credit",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "address",
                  "sku"
                ],
                "properties": {
                  "address": {
                    "type": "string",
                    "description": "Wallet holding the credit"
                  },
                  "sku": {
                    "type": "string",
                    "description": "SKU to discount"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Discount token minted (15-min expiry, wallet-bound, SKU-bound).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string",
                      "description": "Pass as ?rdisc= on the buy route"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cashback/claim": {
      "post": {
        "tags": [
          "rewards"
        ],
        "summary": "Claim Earn-Anywhere cashback for a partner-door purchase",
        "description": "For purchases routed through cashback-eligible partner doors listed in https://brianbooms.com/.well-known/agent-cashback.json. Credit posts when the merchant pays the affiliate commission (typically 30\u201360 days). Manual fallback: email the order confirmation to Brian.Booms@gmail.com.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "identity",
                  "merchant",
                  "order_id",
                  "amount"
                ],
                "properties": {
                  "identity": {
                    "type": "string",
                    "description": "0x wallet address or email"
                  },
                  "merchant": {
                    "type": "string",
                    "example": "Namecheap"
                  },
                  "order_id": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "number",
                    "description": "Order total",
                    "USD": null
                  },
                  "currency": {
                    "type": "string",
                    "default": "USD"
                  },
                  "purchased_at": {
                    "type": "string",
                    "format": "date"
                  },
                  "door": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Claim recorded; credit posts on merchant payout.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "claim_id": {
                      "type": "string",
                      "description": "Save this; credit posts when the merchant pays"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "One of: invalid_identity, merchant_required, order_id_required, invalid_amount, bad_request."
          }
        }
      }
    },
    "/api/v1/freebie/claim": {
      "post": {
        "tags": [
          "rewards"
        ],
        "summary": "Claim the one-click freebie (one per wallet, ever)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "wallet",
                  "sku"
                ],
                "properties": {
                  "wallet": {
                    "type": "string",
                    "description": "0x wallet address"
                  },
                  "sku": {
                    "type": "string",
                    "example": "wallpaper-pack-vol1"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Freebie token minted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "token": {
                      "type": "string"
                    },
                    "buy_url": {
                      "type": "string",
                      "description": "Fetch with ?address=YOUR_WALLET to download"
                    },
                    "expires_in_seconds": {
                      "type": "integer",
                      "example": 900
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "One of: invalid_wallet, sku_not_freebie, bad_request."
          },
          "409": {
            "description": "already_claimed \u2014 one freebie per wallet per product."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DigitalFulfillment": {
        "type": "object",
        "properties": {
          "order_id": {
            "type": "string",
            "example": "bb_m3xample"
          },
          "sku": {
            "type": "string"
          },
          "product": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "price_usdc": {
            "type": "string"
          },
          "amount_paid_usdc": {
            "type": "string"
          },
          "payer": {
            "type": "string"
          },
          "network": {
            "type": "string",
            "example": "base"
          },
          "asset": {
            "type": "string",
            "example": "USDC"
          },
          "rewards": {
            "type": "object",
            "description": "Booms Rewards earned on this purchase"
          },
          "download_url": {
            "type": "string",
            "description": "Personal download link \u2014 do not share"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "ReservationFulfillment": {
        "type": "object",
        "description": "Leases, game licenses, and commissions \u2014 payment reserves; Brian fulfills personally.",
        "properties": {
          "order_id": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "product": {
            "type": "string"
          },
          "price_usdc": {
            "type": "string"
          },
          "amount_paid_usdc": {
            "type": "string"
          },
          "payer": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "paid_awaiting_clearance",
              "commission_received"
            ]
          },
          "rewards": {
            "type": "object"
          },
          "message": {
            "type": "string"
          },
          "fulfillment": {
            "type": "string"
          },
          "next": {
            "type": "string"
          }
        }
      }
    }
  }
}