{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Receipt Schema",
    "type": "object",
    "additionalProperties": false,
    "required": [
        "transaction_date",
        "price_total"
    ],
    "properties": {
        "_id": {
            "type": "string",
            "description": "Unique identifier for this archetype record",
            "maxLength": 50,
            "default": ""
        },
        "draft": {
            "type": "boolean",
            "description": "Indicates this archetype record is a draft and is not published",
            "default": false
        },
        "created": {
            "type": "string",
            "description": "Date and time this archetype record was created in ISO 8601 date standard e.g. YYYY-MM-DDThh:mm:ss.sTZD",
            "_format": "date-time",
            "default": ""
        },
        "updated": {
            "type": "string",
            "description": "Date and time this archetype record was updated in ISO 8601 date standard e.g. YYYY-MM-DDThh:mm:ss.sTZD",
            "_format": "date-time",
            "default": ""
        },
        "transaction_date": {
            "type": "string",
            "description": "Date and time of the transaction in ISO 8601 date standard e.g. YYYY-MM-DDThh:mm:ss.sTZD",
            "_format": "date-time",
            "default": ""
        },
        "price_total": {
            "type": "number",
            "description": "Total purchase price in cents as an integer (whole number)",
            "minimum": 0,
            "default": 0
        },
        "price_shipping": {
            "type": "number",
            "description": "Total shipping cost in cents as an integer (whole number)",
            "minimum": 0,
            "default": 0
        },
        "price_tax": {
            "type": "number",
            "description": "Total sales tax in cents as an integer (whole number)",
            "minimum": 0,
            "default": 0
        },
        "currency": {
            "enum": [
                "AED",
                "AFN",
                "ALL",
                "AMD",
                "ANG",
                "AOA",
                "ARS",
                "AUD",
                "AWG",
                "AZN",
                "BAM",
                "BBD",
                "BDT",
                "BGN",
                "BHD",
                "BIF",
                "BMD",
                "BND",
                "BOB",
                "BOV",
                "BRL",
                "BSD",
                "BTN",
                "BWP",
                "BYR",
                "BZD",
                "CAD",
                "CDF",
                "CHE",
                "CHF",
                "CHW",
                "CLF",
                "CLP",
                "CNY",
                "COP",
                "COU",
                "CRC",
                "CUC",
                "CUP",
                "CVE",
                "CZK",
                "DJF",
                "DKK",
                "DOP",
                "DZD",
                "EGP",
                "ERN",
                "ETB",
                "EUR",
                "FJD",
                "FKP",
                "GBP",
                "GEL",
                "GHS",
                "GIP",
                "GMD",
                "GNF",
                "GTQ",
                "GYD",
                "HKD",
                "HNL",
                "HRK",
                "HTG",
                "HUF",
                "IDR",
                "ILS",
                "INR",
                "IQD",
                "IRR",
                "ISK",
                "JMD",
                "JOD",
                "JPY",
                "KES",
                "KGS",
                "KHR",
                "KMF",
                "KPW",
                "KRW",
                "KWD",
                "KYD",
                "KZT",
                "LAK",
                "LBP",
                "LKR",
                "LRD",
                "LSL",
                "LTL",
                "LVL",
                "LYD",
                "MAD",
                "MDL",
                "MGA",
                "MKD",
                "MMK",
                "MNT",
                "MOP",
                "MRO",
                "MUR",
                "MVR",
                "MWK",
                "MXN",
                "MXV",
                "MYR",
                "MZN",
                "NAD",
                "NGN",
                "NIO",
                "NOK",
                "NPR",
                "NZD",
                "OMR",
                "PAB",
                "PEN",
                "PGK",
                "PHP",
                "PKR",
                "PLN",
                "PYG",
                "QAR",
                "RON",
                "RSD",
                "RUB",
                "RWF",
                "SAR",
                "SBD",
                "SCR",
                "SDG",
                "SEK",
                "SGD",
                "SHP",
                "SLL",
                "SOS",
                "SRD",
                "SSP",
                "STD",
                "SYP",
                "SZL",
                "THB",
                "TJS",
                "TMT",
                "TND",
                "TOP",
                "TRY",
                "TTD",
                "TWD",
                "TZS",
                "UAH",
                "UGX",
                "USD",
                "USN",
                "USS",
                "UYI",
                "UYU",
                "UZS",
                "VEF",
                "VND",
                "VUV",
                "WST",
                "XAF",
                "XAG",
                "XAU",
                "XBA",
                "XBB",
                "XBC",
                "XBD",
                "XCD",
                "XDR",
                "XFU",
                "XOF",
                "XPD",
                "XPF",
                "XPT",
                "XTS",
                "XXX",
                "YER",
                "ZAR",
                "ZMW"
            ],
            "description": "ISO 4217 currency code",
            "default": "USD"
        },
        "paid": {
            "type": "boolean",
            "description": "Boolean to indicate whether the receipt has been paid for",
            "default": true
        },
        "shipped": {
            "type": "boolean",
            "description": "Boolean to indicate whether the order has been shipped",
            "default": false
        },
        "notes": {
            "type": "string",
            "description": "Order notes from the customer who purchased the product",
            "maxLength": 3000,
            "default": ""
        },
        "discount_code": {
            "type": "string",
            "description": "Coupon or promotional code used, if any",
            "maxLength": 200,
            "default": ""
        },
        "discount_percentage": {
            "type": "number",
            "description": "A number percentage discount to be applied to the order",
            "minimum": 0,
            "default": 0
        },
        "products": {
            "type": "array",
            "description": "An array of the products purchased",
            "additionalItems": false,
            "maxItems": 300,
            "minItems": 1,
            "default": [],
            "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                    "product_archetype_id",
                    "product_price",
                    "product_quantity"
                ],
                "properties": {
                    "product_archetype_id": {
                        "type": "string",
                        "description": "Product Archetype ID",
                        "maxLength": 50,
                        "default": ""
                    },
                    "product_price": {
                        "type": "integer",
                        "description": "Product price in cents as an integer (whole number)",
                        "minimum": 0,
                        "maximum": 999999999999999,
                        "default": 0
                    },
                    "product_quantity": {
                        "type": "integer",
                        "description": "Quantity of the purchased product",
                        "maximum": 999999999999999,
                        "default": 1
                    }
                }
            }
        },
        "customer_first_name": {
            "type": "string",
            "description": "First name of the buyer",
            "maxLength": 100,
            "default": ""
        },
        "customer_last_name": {
            "type": "string",
            "description": "Last name of the buyer",
            "maxLength": 100,
            "default": ""
        },
        "customer_payment_method": {
            "enum": [
                "pp",
                "cc",
                "ck",
                "mo",
                "other"
            ],
            "description": "The payment method used. May be pp, cc, ck, mo, or other (stands for paypal, credit card, check, money order, other)",
            "default": "cc"
        },
        "customer_email": {
            "type": "string",
            "description": "Email address of the buyer",
            "maxLength": 100,
            "_format": "email",
            "default": ""
        },
        "customer_phone_number": {
            "type": "string",
            "description": "Phone number of the buyer",
            "maxLength": 50,
            "default": ""
        },
        "customer_address": {
            "type": "string",
            "description": "To add multiple address lines, use \n. For example, 1234 Gl\u00fccklichkeit Stra\u00dfe\nHinterhaus 5. Etage li.",
            "maxLength": 100,
            "default": ""
        },
        "customer_postal_code": {
            "type": "string",
            "maxLength": 30,
            "default": ""
        },
        "customer_city": {
            "type": "string",
            "maxLength": 100,
            "default": ""
        },
        "customer_country_code": {
            "enum": [
                "AF",
                "AX",
                "AL",
                "DZ",
                "AS",
                "AD",
                "AO",
                "AI",
                "AQ",
                "AG",
                "AR",
                "AM",
                "AW",
                "AU",
                "AT",
                "AZ",
                "BS",
                "BH",
                "BD",
                "BB",
                "BY",
                "BE",
                "BZ",
                "BJ",
                "BM",
                "BT",
                "BO",
                "BA",
                "BW",
                "BV",
                "BR",
                "IO",
                "BN",
                "BG",
                "BF",
                "BI",
                "KH",
                "CM",
                "CA",
                "CV",
                "KY",
                "CF",
                "TD",
                "CL",
                "CN",
                "CX",
                "CC",
                "CO",
                "KM",
                "CG",
                "CD",
                "CK",
                "CR",
                "CI",
                "HR",
                "CU",
                "CY",
                "CZ",
                "DK",
                "DJ",
                "DM",
                "DO",
                "EC",
                "EG",
                "SV",
                "GQ",
                "ER",
                "EE",
                "ET",
                "FK",
                "FO",
                "FJ",
                "FI",
                "FR",
                "GF",
                "PF",
                "TF",
                "GA",
                "GM",
                "GE",
                "DE",
                "GH",
                "GI",
                "GR",
                "GL",
                "GD",
                "GP",
                "GU",
                "GT",
                "GG",
                "GN",
                "GW",
                "GY",
                "HT",
                "HM",
                "VA",
                "HN",
                "HK",
                "HU",
                "IS",
                "IN",
                "ID",
                "IR",
                "IQ",
                "IE",
                "IM",
                "IL",
                "IT",
                "JM",
                "JP",
                "JE",
                "JO",
                "KZ",
                "KE",
                "KI",
                "KR",
                "KW",
                "KG",
                "LA",
                "LV",
                "LB",
                "LS",
                "LR",
                "LY",
                "LI",
                "LT",
                "LU",
                "MO",
                "MK",
                "MG",
                "MW",
                "MY",
                "MV",
                "ML",
                "MT",
                "MH",
                "MQ",
                "MR",
                "MU",
                "YT",
                "MX",
                "FM",
                "MD",
                "MC",
                "MN",
                "ME",
                "MS",
                "MA",
                "MZ",
                "MM",
                "NA",
                "NR",
                "NP",
                "NL",
                "AN",
                "NC",
                "NZ",
                "NI",
                "NE",
                "NG",
                "NU",
                "NF",
                "MP",
                "NO",
                "OM",
                "PK",
                "PW",
                "PS",
                "PA",
                "PG",
                "PY",
                "PE",
                "PH",
                "PN",
                "PL",
                "PT",
                "PR",
                "QA",
                "RE",
                "RO",
                "RU",
                "RW",
                "BL",
                "SH",
                "KN",
                "LC",
                "MF",
                "PM",
                "VC",
                "WS",
                "SM",
                "ST",
                "SA",
                "SN",
                "RS",
                "SC",
                "SL",
                "SG",
                "SK",
                "SI",
                "SB",
                "SO",
                "ZA",
                "GS",
                "ES",
                "LK",
                "SD",
                "SR",
                "SJ",
                "SZ",
                "SE",
                "CH",
                "SY",
                "TW",
                "TJ",
                "TZ",
                "TH",
                "TL",
                "TG",
                "TK",
                "TO",
                "TT",
                "TN",
                "TR",
                "TM",
                "TC",
                "TV",
                "UG",
                "UA",
                "AE",
                "GB",
                "US",
                "UM",
                "UY",
                "UZ",
                "VU",
                "VE",
                "VN",
                "VG",
                "VI",
                "WF",
                "EH",
                "YE",
                "ZM",
                "ZW"
            ],
            "description": "code as per ISO-3166-1 ALPHA-2, e.g. US, AU, IN",
            "default": "US"
        },
        "customer_region": {
            "type": "string",
            "maxLength": 100,
            "description": "The general region where you live. Can be a US state, or a province, for instance.",
            "default": ""
        },
        "shipping_first_name": {
            "type": "string",
            "description": "First name of the person the product(s) will be shipped to",
            "default": ""
        },
        "shipping_last_name": {
            "type": "string",
            "description": "Last name of the person the product(s) will be shipped to",
            "default": ""
        },
        "shipping_email": {
            "type": "string",
            "description": "Email address of the person the item is being shipped to",
            "maxLength": 100,
            "_format": "email",
            "default": ""
        },
        "shipping_phone_number": {
            "type": "string",
            "description": "Phone number of the person the item is being shipped to",
            "maxLength": 50,
            "default": ""
        },
        "shipping_address": {
            "type": "string",
            "description": "To add multiple address lines, use \n. For example, 1234 Gl\u00fccklichkeit Stra\u00dfe\nHinterhaus 5. Etage li.",
            "default": ""
        },
        "shipping_postal_code": {
            "type": "string",
            "default": ""
        },
        "shipping_city": {
            "type": "string",
            "default": ""
        },
        "shipping_region": {
            "type": "string",
            "description": "The general region where you live. Can be a US state, or a province, for instance.",
            "default": ""
        },
        "shipping_country_code": {
            "enum": [
                "AF",
                "AX",
                "AL",
                "DZ",
                "AS",
                "AD",
                "AO",
                "AI",
                "AQ",
                "AG",
                "AR",
                "AM",
                "AW",
                "AU",
                "AT",
                "AZ",
                "BS",
                "BH",
                "BD",
                "BB",
                "BY",
                "BE",
                "BZ",
                "BJ",
                "BM",
                "BT",
                "BO",
                "BA",
                "BW",
                "BV",
                "BR",
                "IO",
                "BN",
                "BG",
                "BF",
                "BI",
                "KH",
                "CM",
                "CA",
                "CV",
                "KY",
                "CF",
                "TD",
                "CL",
                "CN",
                "CX",
                "CC",
                "CO",
                "KM",
                "CG",
                "CD",
                "CK",
                "CR",
                "CI",
                "HR",
                "CU",
                "CY",
                "CZ",
                "DK",
                "DJ",
                "DM",
                "DO",
                "EC",
                "EG",
                "SV",
                "GQ",
                "ER",
                "EE",
                "ET",
                "FK",
                "FO",
                "FJ",
                "FI",
                "FR",
                "GF",
                "PF",
                "TF",
                "GA",
                "GM",
                "GE",
                "DE",
                "GH",
                "GI",
                "GR",
                "GL",
                "GD",
                "GP",
                "GU",
                "GT",
                "GG",
                "GN",
                "GW",
                "GY",
                "HT",
                "HM",
                "VA",
                "HN",
                "HK",
                "HU",
                "IS",
                "IN",
                "ID",
                "IR",
                "IQ",
                "IE",
                "IM",
                "IL",
                "IT",
                "JM",
                "JP",
                "JE",
                "JO",
                "KZ",
                "KE",
                "KI",
                "KR",
                "KW",
                "KG",
                "LA",
                "LV",
                "LB",
                "LS",
                "LR",
                "LY",
                "LI",
                "LT",
                "LU",
                "MO",
                "MK",
                "MG",
                "MW",
                "MY",
                "MV",
                "ML",
                "MT",
                "MH",
                "MQ",
                "MR",
                "MU",
                "YT",
                "MX",
                "FM",
                "MD",
                "MC",
                "MN",
                "ME",
                "MS",
                "MA",
                "MZ",
                "MM",
                "NA",
                "NR",
                "NP",
                "NL",
                "AN",
                "NC",
                "NZ",
                "NI",
                "NE",
                "NG",
                "NU",
                "NF",
                "MP",
                "NO",
                "OM",
                "PK",
                "PW",
                "PS",
                "PA",
                "PG",
                "PY",
                "PE",
                "PH",
                "PN",
                "PL",
                "PT",
                "PR",
                "QA",
                "RE",
                "RO",
                "RU",
                "RW",
                "BL",
                "SH",
                "KN",
                "LC",
                "MF",
                "PM",
                "VC",
                "WS",
                "SM",
                "ST",
                "SA",
                "SN",
                "RS",
                "SC",
                "SL",
                "SG",
                "SK",
                "SI",
                "SB",
                "SO",
                "ZA",
                "GS",
                "ES",
                "LK",
                "SD",
                "SR",
                "SJ",
                "SZ",
                "SE",
                "CH",
                "SY",
                "TW",
                "TJ",
                "TZ",
                "TH",
                "TL",
                "TG",
                "TK",
                "TO",
                "TT",
                "TN",
                "TR",
                "TM",
                "TC",
                "TV",
                "UG",
                "UA",
                "AE",
                "GB",
                "US",
                "UM",
                "UY",
                "UZ",
                "VU",
                "VE",
                "VN",
                "VG",
                "VI",
                "WF",
                "EH",
                "YE",
                "ZM",
                "ZW"
            ],
            "description": "code as per ISO-3166-1 ALPHA-2, e.g. US, AU, IN",
            "default": "US"
        }
    }
}