Receipt

Extract merchant, items, totals, and payment method.

Schema Key

receipt

Usage

Use this template when creating a schema via the API or SDK:

const schema = await client.schemas.create('my-workspace', {
  schemaKey: 'receipt',
  name: 'Receipt',
  definition: { /* see definition below */ },
});

Definition

{
  "type": "object",
  "properties": {
    "merchant": {
      "type": "object",
      "description": "Information about the merchant or store.",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the merchant or store."
        },
        "address": {
          "type": "string",
          "description": "Address of the merchant as printed on the receipt."
        },
        "phone": {
          "type": "string",
          "description": "Phone number of the merchant."
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "date": {
      "type": "object",
      "description": "Date of the transaction.",
      "properties": {
        "year": {
          "type": "integer",
          "description": "Year (e.g. 2024)."
        },
        "month": {
          "type": "integer",
          "description": "Month (1-12).",
          "minimum": 1,
          "maximum": 12
        },
        "day": {
          "type": "integer",
          "description": "Day of the month.",
          "minimum": 1,
          "maximum": 31
        }
      },
      "required": [
        "year",
        "month",
        "day"
      ],
      "additionalProperties": false
    },
    "items": {
      "type": "array",
      "description": "List of purchased items.",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name or description of the item."
          },
          "quantity": {
            "type": "number",
            "description": "Quantity purchased."
          },
          "price": {
            "type": "number",
            "description": "Price per item."
          },
          "amount": {
            "type": "number",
            "description": "Total amount for this item (quantity x price)."
          }
        },
        "required": [
          "name",
          "amount"
        ],
        "additionalProperties": false
      }
    },
    "subtotal": {
      "type": "number",
      "description": "Sum of all items before tax."
    },
    "tax": {
      "type": "number",
      "description": "Tax amount."
    },
    "total": {
      "type": "number",
      "description": "Total amount paid."
    },
    "payment_method": {
      "type": "string",
      "description": "Method of payment (e.g. Cash, Visa, Mastercard)."
    },
    "currency": {
      "type": "string",
      "description": "Currency code (e.g. USD, EUR)."
    }
  },
  "required": [
    "merchant",
    "date",
    "items",
    "total"
  ],
  "additionalProperties": false
}