{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ocapi-shop/json-schema/ocapi-shop-checkout-input-schema.json",
  "title": "CheckoutInput",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ocapi-shop-openapi.yml#/components/schemas/CheckoutInput",
  "type": "object",
  "properties": {
    "currency": {
      "type": "string",
      "description": "ISO 4217 code for the store's prices"
    },
    "time_zone": {
      "type": "string",
      "enum": [
        "America/Tijuana",
        "America/Mexico_City",
        "America/Cancun",
        "America/Belize",
        "America/Guatemala",
        "America/El_Salvador",
        "America/Tegucigalpa",
        "America/Managua",
        "America/Costa_Rica",
        "America/Panama",
        "America/Havana",
        "America/Port-au-Prince",
        "America/Santo_Domingo",
        "America/Puerto_Rico",
        "America/Bogota",
        "America/Guayaquil",
        "America/Lima",
        "America/Caracas",
        "America/La_Paz",
        "America/Guyana",
        "America/Paramaribo",
        "America/Manaus",
        "America/Sao_Paulo",
        "America/Asuncion",
        "America/Santiago",
        "America/Argentina/Buenos_Aires",
        "America/Montevideo",
        "America/Los_Angeles",
        "America/Denver",
        "America/Chicago",
        "America/New_York",
        "America/Vancouver",
        "America/Toronto",
        "Atlantic/Canary",
        "Europe/Madrid"
      ],
      "description": "The store's time zone: its days in metrics and order times"
    },
    "shipping": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Whether checkout charges shipping"
        },
        "default_cost": {
          "type": "number",
          "minimum": 0,
          "description": "The cost for a city no zone lists"
        },
        "free_above": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "description": "Shipping is free when the items reach this amount; null never"
        },
        "zones": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ShippingZone"
          },
          "description": "Costs by city; the first zone listing the customer's city wins"
        },
        "postal_rules": {
          "type": "array",
          "maxItems": 50,
          "items": {
            "$ref": "#/$defs/ShippingPostalRule"
          },
          "description": "Costs by postal code, checked before distance and city zones. Replaces the list; empty removes them"
        },
        "weight_tiers": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "$ref": "#/$defs/ShippingWeightTier"
          },
          "description": "Prices by the cart's weight (products' weight × quantity) that replace default_cost; empty removes them"
        },
        "distance": {
          "oneOf": [
            {
              "$ref": "#/$defs/ShippingDistance"
            },
            {
              "type": "null"
            }
          ],
          "description": "Prices by distance from the store; null removes them. Fields left out keep their values"
        }
      }
    },
    "pickup_locations": {
      "type": "array",
      "maxItems": 10,
      "items": {
        "$ref": "#/$defs/PickupLocation"
      },
      "description": "Replaces the places customers can collect their order at, with no shipping cost; an empty list stops offering pickup. Keep a location's id to update it"
    },
    "manual_payment_instructions": {
      "type": "string",
      "maxLength": 500,
      "description": "What customers who pay over WhatsApp are told at checkout, such as the account to pay to"
    },
    "tips": {
      "type": "object",
      "description": "Tips at checkout. Fields left out keep their values",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Whether checkout asks customers for a tip, added to the order after shipping"
        },
        "percentages": {
          "type": "array",
          "maxItems": 3,
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "description": "Suggested tips, as percentages of the items after discounts; an empty list offers none"
        },
        "custom_amount": {
          "type": "boolean",
          "description": "Whether customers may type their own tip amount"
        }
      }
    },
    "minimum_order": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "description": "The item subtotal, after discounts, an order needs before checkout takes it; null or 0 removes the minimum"
    },
    "taxes": {
      "type": "object",
      "description": "Tax and the service charge at checkout. Fields left out keep their values. Ocapi doesn't file taxes: the merchant is responsible",
      "properties": {
        "prices_include_tax": {
          "type": "boolean",
          "description": "true (the default): prices already include the tax and checkout only shows it; false adds it on top"
        },
        "rate": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 100,
          "description": "The store's tax rate in percent; null charges none. Products and categories may override it (tax_rate)"
        },
        "label": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 30,
          "description": "The tax's name, like IVA, IGV or ICMS; null for the default"
        },
        "shipping_taxed": {
          "type": "boolean",
          "description": "Whether shipping is taxed at the store's rate"
        },
        "service_charge": {
          "$ref": "#/$defs/ServiceCharge"
        }
      }
    },
    "unpaid_orders": {
      "type": "object",
      "description": "Payment reminders and auto-cancel for manualPayment orders whose payment doesn't arrive. Fields left out keep their values",
      "properties": {
        "reminders": {
          "type": "boolean",
          "description": "Whether customers get payment reminders by email, and on WhatsApp when they asked for updates there"
        },
        "reminder_hours": {
          "type": "array",
          "maxItems": 3,
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 336
          },
          "description": "When the reminders go, in hours after the order"
        },
        "auto_cancel_hours": {
          "type": [
            "integer",
            "null"
          ],
          "enum": [
            12,
            24,
            48,
            72,
            120,
            168,
            null
          ],
          "description": "Cancel unpaid orders this many hours after the order (orders older than the switch count from when it was turned on); null turns it off"
        },
        "restock_on_cancel": {
          "type": "boolean",
          "description": "Whether an automatic cancel puts the items back in stock"
        }
      }
    },
    "deposits": {
      "type": "object",
      "description": "A deposit customers pay online at checkout, leaving the balance for later (catering, cakes, bookings, custom\nwork). Products may have their own (a product's deposit), which applies even when the store has none. Fields left\nout keep their values.\n",
      "properties": {
        "rule": {
          "type": [
            "object",
            "null"
          ],
          "description": "The store-wide deposit; null turns it off",
          "properties": {
            "mode": {
              "type": "string",
              "enum": [
                "optional",
                "required"
              ],
              "description": "optional (the default) lets the customer pay it all instead; required charges only the deposit online"
            },
            "type": {
              "type": "string",
              "enum": [
                "percentage",
                "fixed"
              ],
              "description": "percentage (the default) of the order's total, or a fixed amount per order"
            },
            "amount": {
              "type": "number",
              "description": "Above 0: a percentage below 100, or an amount"
            }
          },
          "required": [
            "amount"
          ]
        },
        "minimum_order": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "description": "Deposits only apply from this item subtotal (after discounts) up; null applies them to every order"
        },
        "balance_reminder_hours": {
          "type": [
            "integer",
            "null"
          ],
          "enum": [
            12,
            24,
            48,
            72,
            null
          ],
          "description": "Email customers about their balance this many hours before their delivery time or booking; null sends none"
        }
      }
    },
    "payment_methods": {
      "type": "object",
      "description": "Payment methods to turn on (true) or off (false) at checkout",
      "properties": {
        "mercadopago": {
          "type": "boolean"
        },
        "paypal": {
          "type": "boolean"
        },
        "stripe": {
          "type": "boolean"
        },
        "wompi": {
          "type": "boolean"
        },
        "manualPayment": {
          "type": "boolean",
          "description": "Payment coordinated over WhatsApp"
        }
      }
    },
    "wallets": {
      "type": "array",
      "maxItems": 10,
      "items": {
        "$ref": "#/$defs/PaymentWalletInput"
      },
      "description": "Replaces the wallets and bank-transfer keys customers pay to by hand, in the order checkout lists them; an empty\nlist removes them. Keep a wallet's id to update it. Each is its own choice at checkout: the customer places the\norder, pays and uploads a receipt, and the order waits as manualPayment (with the unpaid_orders reminders and\nauto-cancel) until you set it paid.\n"
    },
    "mercadopago_exclusions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/MercadopagoExclusion"
      },
      "description": "MercadoPago's ways to pay to leave out of checkout; an empty list offers them all. At least one payment type must stay"
    }
  },
  "$defs": {
    "MercadopagoExclusion": {
      "type": "string",
      "enum": [
        "credit_card",
        "debit_card",
        "prepaid_card",
        "ticket",
        "atm",
        "bank_transfer",
        "digital_currency",
        "pse",
        "pix"
      ],
      "description": "MercadoPago payment types (ticket is cash vouchers such as OXXO, Efecty, Boleto or Rapipago; bank_transfer covers\nPSE, Pix and SPEI; digital_currency is Mercado Crédito), or pse and pix to leave out only that bank transfer.\nThe buyer's Mercado Pago balance is always offered.\n"
    },
    "PaymentWalletInput": {
      "type": "object",
      "required": [
        "kind",
        "account"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "An existing wallet's id (wal_...), to update it"
        },
        "kind": {
          "$ref": "#/$defs/PaymentWalletKind"
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 40,
          "description": "The name customers see; required for other, the others are named after their kind"
        },
        "account": {
          "type": "string",
          "maxLength": 100,
          "description": "The phone number, key, alias, CVU, CBU or CLABE to pay to (a CLABE's check digit is verified)"
        },
        "holder_name": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 60,
          "description": "Whose account it is; required for pix"
        },
        "city": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 40,
          "description": "The holder's city, which a Pix code carries; required for pix"
        },
        "instructions": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 500,
          "description": "What else customers should know, such as the reference to write"
        },
        "qr_image_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "A QR image for it (PNG, JPEG or WebP), uploaded first with createUpload; null removes it. A pix wallet in a BRL store gets a Pix code QR with the amount instead"
        }
      }
    },
    "PaymentWalletKind": {
      "type": "string",
      "enum": [
        "nequi",
        "daviplata",
        "breb",
        "yape",
        "plin",
        "pix",
        "mercadopago_alias",
        "bank_alias",
        "spei",
        "other"
      ],
      "description": "nequi, daviplata and breb (a Bre-B key) in Colombia; yape and plin in Peru; pix (a Pix key) in Brazil;\nmercadopago_alias (a Mercado Pago alias or CVU) and bank_alias (a bank alias or CBU) in Argentina; spei (an 18-digit\nCLABE) in Mexico; other for anything else, named by `name`. More kinds may be added.\n"
    },
    "PickupLocation": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Set by Ocapi; send it back to keep a location's identity"
        },
        "name": {
          "type": "string",
          "maxLength": 80
        },
        "address": {
          "type": "string",
          "maxLength": 200,
          "description": "Where it is and when to come, shown to the customer"
        }
      }
    },
    "ServiceCharge": {
      "type": [
        "object",
        "null"
      ],
      "description": "Added to every order (or only to delivered or collected ones) and never taxed; null for none, and sending null removes it",
      "required": [
        "type",
        "amount"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "percentage",
            "fixed"
          ],
          "description": "A percentage of the items after discounts, or a fixed amount"
        },
        "amount": {
          "type": "number",
          "minimum": 0
        },
        "label": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 30,
          "description": "Its name on the order, like Servicio"
        },
        "only": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "delivery",
            "pickup",
            "dine_in",
            null
          ],
          "description": "Only orders delivered to an address, collected at a pickup location, or ordered from a table (dine_in); null for every order"
        }
      }
    },
    "ShippingDistance": {
      "type": "object",
      "description": "Local delivery priced by distance from the store. Applies only while Ocapi has a geocoder (available); past the last band the store doesn't deliver",
      "properties": {
        "origin_address": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 200,
          "description": "Where deliveries leave from; located automatically when latitude and longitude are left out"
        },
        "latitude": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90
        },
        "longitude": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -180,
          "maximum": 180
        },
        "bands": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "$ref": "#/$defs/ShippingDistanceBand"
          }
        }
      }
    },
    "ShippingDistanceBand": {
      "type": "object",
      "required": [
        "up_to_km",
        "cost"
      ],
      "properties": {
        "up_to_km": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "The band holds addresses up to this many kilometres from the origin, in a straight line"
        },
        "cost": {
          "type": "number",
          "minimum": 0
        }
      }
    },
    "ShippingPostalRule": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Set by Ocapi; send it back to keep a rule's identity"
        },
        "codes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Exact postal codes; matched ignoring case, spaces and dashes"
        },
        "prefixes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Postal codes starting with these; the longest matching prefix wins"
        },
        "cost": {
          "type": "number",
          "minimum": 0
        }
      }
    },
    "ShippingWeightTier": {
      "type": "object",
      "required": [
        "up_to_kg",
        "cost"
      ],
      "properties": {
        "up_to_kg": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "The tier holds carts up to this many kilograms (from the previous tier's limit); past the last tier, the last one applies"
        },
        "cost": {
          "type": "number",
          "minimum": 0
        }
      }
    },
    "ShippingZone": {
      "type": "object",
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Kept from the zone you read; made up when left out"
        },
        "name": {
          "type": "string",
          "description": "The zone's name, such as Bogotá"
        },
        "country_code": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 3166 country code"
        },
        "cities": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          },
          "description": "Cities this cost applies to; matched ignoring case and accents"
        },
        "cost": {
          "type": "number",
          "minimum": 0
        },
        "weight_tiers": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "$ref": "#/$defs/ShippingWeightTier"
          },
          "description": "Prices by the cart's weight that replace cost for this zone; an empty list removes them, and left out keeps them"
        }
      }
    }
  }
}