Skip to content

Instantly share code, notes, and snippets.

@d2kagw
Last active September 20, 2023 01:02
Show Gist options
  • Select an option

  • Save d2kagw/e5eb5dc1cd6a8ea668e3ff2a62a59bb2 to your computer and use it in GitHub Desktop.

Select an option

Save d2kagw/e5eb5dc1cd6a8ea668e3ff2a62a59bb2 to your computer and use it in GitHub Desktop.
schema_commerce_purchases.json - Via automated deployment - Visit https://learn.lexer.io for more information.
{
"type": "object",
"properties": {
"records": {
"type": "array",
"items": {
"title": "Purchase",
"type": "object",
"description": "A purchase event object.",
"required": [
"link",
"action_at",
"purchase_id",
"type",
"products"
],
"properties": {
"link": {
"type": "object",
"oneOf": [
{
"title": "Email Link",
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email",
"pattern": "(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$)",
"example": "jane@fake.com"
}
}
},
{
"title": "Email sha256 Link",
"type": "object",
"properties": {
"email_sha256": {
"type": "string",
"description": "Ensure that the email address is lowercase before hashing.",
"example": "39c500..."
}
}
},
{
"title": "Email md5 Link",
"type": "object",
"required": [
"email_md5"
],
"properties": {
"email_md5": {
"type": "string",
"description": "Ensure that the email address is lowercase before hashing.",
"example": "39c500..."
}
}
},
{
"title": "Mobile Link",
"type": "object",
"properties": {
"mobile": {
"type": "string",
"description": "Formatted with the international code with no spaces or symbols.",
"example": "61400000000"
}
}
},
{
"title": "Customer ID Link",
"type": "object",
"required": [
"customer_id"
],
"properties": {
"customer_id": {
"type": "string",
"description": "A unique identifier for a customer.",
"example": 123456789
},
"system_name": {
"type": "string",
"description": "An optional name for the system of origin.",
"example": "point_of_sale"
}
}
},
{
"title": "External Link",
"type": "object",
"required": [
"external_id"
],
"properties": {
"external_id": {
"type": "string",
"description": "A unique identifier for a profile.",
"example": 123456789
},
"system_name": {
"type": "string",
"description": "An optional name for the system of origin.",
"example": "point_of_sale"
}
}
},
{
"title": "Legacy Customer Link",
"type": "object",
"required": [
"link_type",
"link_value"
],
"properties": {
"link_type": {
"title": "Link Type",
"type": "string",
"enum": [
"email",
"email_sha256",
"customer_id",
"mobile",
"external_id",
"email_md5"
],
"example": "email"
},
"link_value": {
"title": "Link Value",
"type": "string",
"minLength": 1,
"example": "jane@fake.com"
},
"id_type": {
"title": "External ID Type",
"type": "string",
"default": "default"
}
}
}
]
},
"action_at": {
"title": "action_at",
"type": "string",
"format": "date-time"
},
"purchase_id": {
"title": "purchase_id",
"type": "string",
"example": "53059a..."
},
"store": {
"title": "Store",
"type": "object",
"description": "A store entity",
"required": [
"store_id"
],
"properties": {
"store_id": {
"title": "Store ID",
"type": "string",
"example": "40bf96..."
},
"type": {
"title": "Store Type",
"type": "string",
"enum": [
"physical",
"online",
"concession",
"outlet"
],
"example": "physical"
},
"name": {
"title": "Store Name",
"type": "string",
"example": "St Kilda Outlet"
},
"location": {
"title": "Location",
"type": "object",
"properties": {
"name": {
"title": "Location Name",
"type": "string",
"example": "St Kilda"
},
"coordinates": {
"title": "Coordinates",
"type": "object",
"properties": {
"longitude": {
"title": "Longitude",
"type": "number",
"format": "float"
},
"latitude": {
"title": "Latitude",
"type": "number",
"format": "float"
}
}
}
}
}
}
},
"type": {
"title": "Purchase Type",
"type": "string",
"enum": [
"physical",
"ecommerce"
],
"example": "ecommerce"
},
"currency": {
"title": "Currency",
"type": "string",
"description": "Currency code as ISO 4217",
"example": "USD"
},
"payment_types": {
"title": "Payment Types",
"type": "array",
"minItems": 0,
"items": {
"type": "object",
"title": "Payment Type",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"example": "visa"
},
"total": {
"type": "number",
"example": 100
}
}
}
},
"adjustments": {
"title": "Adjustments",
"type": "array",
"minItems": 0,
"items": {
"title": "Adjustment",
"type": "object",
"required": [
"price_adjustment"
],
"properties": {
"price_adjustment": {
"title": "Price Adjustment",
"type": "number",
"example": 50,
"minimum": 0
},
"adjusted_at": {
"title": "Adjusted At",
"type": "string",
"format": "date-time"
},
"reason": {
"title": "Reason",
"type": "string",
"example": "gift card"
}
}
}
},
"products": {
"title": "Products",
"type": "array",
"minItems": 1,
"items": {
"title": "Purchase Product Reference",
"type": "object",
"required": [
"quantity",
"price_paid"
],
"properties": {
"product_reference": {
"title": "Product Reference",
"type": "object",
"required": [
"id",
"id_type",
"dataset_id"
],
"properties": {
"id": {
"type": "string",
"example": "7ede97..."
},
"id_type": {
"type": "string",
"enum": [
"sku",
"upc",
"product_id"
],
"example": "sku"
},
"dataset_id": {
"type": "string",
"example": "0e2187..."
}
}
},
"price_paid": {
"title": "Price Paid",
"type": "number",
"minimum": 0,
"example": 90
},
"quantity": {
"title": "Quantity",
"type": "number",
"format": "integer",
"minimum": 0,
"example": 2
},
"full_price": {
"title": "Full Price",
"type": "number",
"example": 50
},
"discount": {
"title": "Discount",
"type": "number",
"example": 10
}
}
}
},
"custom_fields": {
"title": "Custom Fields",
"type": "object",
"description": "Custom Fields. Properties are open, but a dataset may be configured to accept only particular fields to facilite automated processing in the Lexer CDP.",
"example": {
"is_gift": true,
"gift_message": "Happy Birthday Kevin!"
}
}
}
},
"minItems": 1,
"maxItems": 100
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment