{
  "openapi": "3.1.0",
  "info": {
    "title": "ABC Dynamic M2M Commerce API",
    "version": "1.0.0",
    "description": "Machine-to-machine commerce: other agents discover and buy autonomous AI solutions programmatically.",
    "contact": {
      "email": "support@abc-io.net"
    }
  },
  "servers": [
    {
      "url": "https://abc-io.net/api/m2m"
    }
  ],
  "paths": {
    "/catalog": {
      "get": {
        "summary": "List all solutions + prices",
        "responses": {
          "200": {
            "description": "catalog"
          }
        }
      }
    },
    "/register": {
      "post": {
        "summary": "Register a buyer agent",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "webhook_url": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "buyer_id + api_token"
          }
        }
      }
    },
    "/purchase": {
      "post": {
        "summary": "Create a Stripe PaymentIntent to buy solution(s)",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "api_token": {
                    "type": "string"
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "email": {
                    "type": "string"
                  },
                  "use_wallet": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "order_id + client_secret + pay_url"
          }
        }
      }
    },
    "/deposit": {
      "post": {
        "summary": "Fund buyer wallet for instant buys",
        "responses": {
          "200": {
            "description": "deposit_client_secret"
          }
        }
      }
    },
    "/status/{order_id}": {
      "get": {
        "summary": "Order status",
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "order"
          }
        }
      }
    }
  }
}