Overview
The Receipt model extracts and structures information from receipts, including merchant information, line items, payments, and tax details.Schema Structure
Root Level Fields
| Field | Type | Description |
|---|---|---|
MerchantName | string? | Name of the merchant issuing the receipt |
MerchantPhoneNumber | string? | Listed phone number of merchant |
MerchantAddress | Address? | Listed address of merchant |
Total | number? | Full transaction total of receipt |
Subtotal | number? | Subtotal before taxes |
TotalTax | number? | Total tax amount |
Tip | number? | Tip amount |
TransactionDate | string? | Date the receipt was issued |
TransactionTime | string? | Time the receipt was issued |
CountryRegion | string? | Country or region where receipt was issued |
ReceiptType | string? | Type of receipt |
Line Item Fields
Each item in theItems array contains:
| Field | Type | Description |
|---|---|---|
Description | string? | Item description |
TotalPrice | number? | Total price for this line item |
Quantity | number? | Quantity of each item |
Price | number? | Individual price of each item unit |
ProductCode | string? | Product code or SKU |
QuantityUnit | string? | Unit of measure |
Payment Fields
Each payment in thePayments array contains:
| Field | Type | Description |
|---|---|---|
Method | string? | Method of payment |
Amount | number? | Amount of payment |
Tax Detail Fields
Each tax detail in theTaxDetails array contains:
| Field | Type | Description |
|---|---|---|
Amount | number? | Tax amount |
Rate | number? | Tax rate as a percentage |
NetAmount | number? | Net amount before tax |
Description | string? | Description of the tax |
Type Definitions
Validation Rules
Basic Validation
- All fields are optional by default
- Items, Payments, and TaxDetails default to empty arrays if not specified
Strict Validation
The following fields are required in strict mode:- MerchantName
- Total
- TransactionDate
- Items (minimum 1 item)
Example Usage
Date Handling
The model accepts dates in multiple formats:- ISO 8601 datetime strings
- YYYY-MM-DD format
Best Practices
- Always validate receipts:
- Access data through the result property:
- Handle optional fields appropriately:
- Check arrays before processing:
- Calculate totals carefully: