{
  "schema_version": "1.0.0",
  "integration": {
    "source": "Gumroad Ping Webhook (sale)",
    "destination": "Airtable Base / Table: Gumroad Sales",
    "mode": "idempotent_upsert"
  },
  "deduplication": {
    "primary_key": "sale_id",
    "airtable_field": "Sale ID",
    "strategy": "lookup_before_write",
    "on_existing_key": "skip_duplicate",
    "re_run_behavior": "Replaying any webhook or historical batch is safe; existing sale_id records are never duplicated."
  },
  "fields": [
    {
      "source_field": "sale_id",
      "source_type": "string",
      "airtable_field": "Sale ID",
      "airtable_type": "singleLineText",
      "required": true,
      "unique_key": true,
      "transform": "trim string; reject if empty"
    },
    {
      "source_field": "email",
      "source_type": "string",
      "airtable_field": "Customer Email",
      "airtable_type": "email",
      "required": true,
      "unique_key": false,
      "transform": "trim and lowercase"
    },
    {
      "source_field": "price",
      "source_type": "integer_or_string_cents",
      "airtable_field": "Price (USD)",
      "airtable_type": "currency",
      "required": true,
      "unique_key": false,
      "transform": "parse integer cents with Decimal, divide by 100, quantize to 0.01"
    },
    {
      "source_field": "product_id",
      "source_type": "string",
      "airtable_field": "Product ID",
      "airtable_type": "singleLineText",
      "required": true,
      "unique_key": false,
      "transform": "trim string; reject if empty"
    },
    {
      "source_field": "created_at",
      "source_type": "string_timestamp",
      "airtable_field": "Sale Timestamp (UTC)",
      "airtable_type": "dateTime",
      "required": true,
      "unique_key": false,
      "transform": "parse ISO-8601 timestamp (accepting Z or numeric offset), convert to UTC, format as YYYY-MM-DDTHH:MM:SSZ"
    }
  ],
  "audit_logging": {
    "logged_per_event": [
      "row_index",
      "sale_id",
      "email",
      "price",
      "product_id",
      "created_at",
      "status"
    ],
    "statuses": [
      "inserted",
      "skipped_duplicate"
    ]
  }
}
