{
  "openapi": "3.1.0",
  "info": {
    "title": "Ticket Fairy direct AP2 receipt overlay",
    "version": "2026-10-23",
    "description": "Supplemental response contract for existing UCP shopping operations. Base requests, authorization and ordinary response schemas remain defined by https://ucp.dev/2026-08-25/services/shopping/rest.openapi.json."
  },
  "servers": [
    {
      "url": "https://www.ticketfairy.com"
    }
  ],
  "externalDocs": {
    "description": "Negotiation, references, verification and recovery",
    "url": "https://www.ticketfairy.com/agentic/ap2-receipts/2026-10-23/spec.md"
  },
  "security": [
    {
      "UcpPlatformProfile": [],
      "HttpSignature": []
    }
  ],
  "paths": {
    "/api/v1/agentic/ucp/checkout-sessions/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      ],
      "get": {
        "summary": "Read the original checkout and available direct AP2 receipts",
        "description": "Uses the existing authenticated UCP GET. This profile must have been negotiated at Create. Get may add eventual immutable receipts without rewriting a retained Complete response.",
        "responses": {
          "200": {
            "description": "Current UCP checkout, or the existing retained idless native-failure body with ucp.status error, messages and the negotiated receipt overlay. The saved HTTP status and original Complete response remain unchanged. Payment success alone does not establish ticket readiness.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "https://www.ticketfairy.com/agentic/ap2-receipts/2026-10-23/schema.json#/$defs/dev.ucp.shopping.checkout"
                    },
                    {
                      "$ref": "https://www.ticketfairy.com/agentic/ap2-receipts/2026-10-23/schema.json#/$defs/failure_delivery"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Current signed application authentication is required."
          },
          "404": {
            "description": "Checkout unavailable to this caller."
          }
        }
      }
    },
    "/api/v1/agentic/ucp/checkout-sessions/{id}/complete": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      ],
      "post": {
        "summary": "Complete the approved checkout and receive available direct AP2 receipts",
        "description": "Submit the existing UCP Complete body with its two mandates, stable Idempotency-Key and current signed request. Recover uncertainty using the same request and original checkout. A matching Complete replay retains its original status and bytes.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "The existing UCP Complete request with negotiated AP2 mandates. See the official base OpenAPI and the offered owned AP2 handler."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Native checkout result, which can still be processing, or the existing idless native-failure body with ucp.status error, messages and the negotiated receipt overlay. Both retain HTTP 200 on Complete and replay. Any delivered receipt is final for its own checkout or payment fact.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "https://www.ticketfairy.com/agentic/ap2-receipts/2026-10-23/schema.json#/$defs/dev.ucp.shopping.checkout"
                    },
                    {
                      "$ref": "https://www.ticketfairy.com/agentic/ap2-receipts/2026-10-23/schema.json#/$defs/failure_delivery"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "A definitive supplied-mandate rejection can carry signed Error receipts. Missing mandates, malformed requests and other refusals retain their existing unsigned error contracts.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "https://www.ticketfairy.com/agentic/ap2-receipts/2026-10-23/schema.json#/$defs/mandate_rejection"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code"
                      ],
                      "additionalProperties": true
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Current signed application authentication is required."
          },
          "404": {
            "description": "Checkout unavailable to this caller."
          },
          "409": {
            "description": "Read the original checkout or retry the exact existing operation as instructed."
          },
          "503": {
            "description": "Outcome or receipt delivery is temporarily unavailable. Keep the original request, checkout and payment identity."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "UcpPlatformProfile": {
        "type": "apiKey",
        "in": "header",
        "name": "UCP-Agent",
        "description": "Identifies the platform profile. It grants no authority alone; follow the existing signed UCP authentication contract."
      },
      "HttpSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "Signature",
        "description": "Existing RFC 9421 signature. Signature-Input and the covered request components, including the profile and operation identity, remain required."
      }
    }
  }
}
