{"openapi":"3.1.0","info":{"title":"Franky Store API","version":"v1","description":"API para que una tienda (o su bodega) lea sus órdenes, pagos y productos de Franky y marque el despacho de sus pedidos. Guía completa: https://auth.soyfranky.com/api/v1/llms.txt"},"servers":[{"url":"https://auth.soyfranky.com/api/v1"}],"security":[{"apiKey":[]}],"paths":{"/store":{"get":{"summary":"La tienda de esta key.","description":"Devuelve la tienda a la que pertenece la key, los estados de pedido que usa (order_statuses: las claves que aparecen en el campo status de una orden, con su etiqueta) y los datos de la key misma. Sirve para comprobar que la key funciona. Permiso: store:read.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"short_name":{"type":"string"},"url":{"type":"string"},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string","const":"CLP"},"timezone":{"type":"string","const":"America/Santiago"},"order_statuses":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"}},"required":["key","label"],"additionalProperties":false}},"key":{"type":"object","properties":{"prefix":{"type":"string"},"label":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}}},"required":["prefix","label","scopes"],"additionalProperties":false}},"required":["id","name","short_name","url","status","currency","timezone","order_statuses","key"],"additionalProperties":false},"example":{"id":"kd7f3m2x9q4w8e1r5t6y7u8i9o0p1a2s","name":"Jardín Secreto","short_name":"jardinsecreto","url":"https://franky.link/jardinsecreto","status":"active","currency":"CLP","timezone":"America/Santiago","order_statuses":[{"key":"created","label":"Recibido"},{"key":"confirmed","label":"Confirmado"},{"key":"cancelled","label":"Cancelado"}],"key":{"prefix":"fk_live_a1B2c3D4","label":"App de reservas","scopes":["store:read","orders:read","payments:read","products:read"]}}}}},"401":{"description":"Falta la API key, está mal escrita, fue revocada o venció.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"La key no tiene el permiso (scope) que pide el endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"La ruta no existe, o el recurso no existe en esta tienda.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 120 llamadas en un minuto. Espera los segundos del header Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Falló algo de nuestro lado. Reintenta más tarde.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders":{"get":{"summary":"Órdenes de la tienda, las más nuevas primero.","description":"Sin filtros recorre todo el historial por páginas. Sin el filtro status deja fuera las órdenes que nunca se pagaron (status payku_pending, expired o pending_payment), igual que el panel de la tienda; para verlas, pídelas con status. Una compra en línea entra a la lista cuando se paga, con su created_at original (ver \"Cómo enterarse de ventas nuevas\"). Las cotizaciones no cuentan como órdenes sin pagar y llevan is_quote: true. Una página puede venir con menos órdenes que limit, o vacía, sin ser la última: sigue pidiendo mientras next_cursor no sea null. payment_status dice si está pagada (fully_paid), pagada en parte (partially_paid) o sin pagar (pending); balance aparece solo cuando hay un abono pagado y un saldo pendiente. Permiso: orders:read.","parameters":[{"name":"status","in":"query","required":false,"description":"Uno o varios status separados por coma, por ejemplo confirmed,delivered. Las claves de la tienda están en GET /store.","schema":{"description":"Uno o varios status separados por coma, por ejemplo confirmed,delivered. Las claves de la tienda están en GET /store.","type":"string"}},{"name":"created_since","in":"query","required":false,"description":"Órdenes creadas desde esta fecha (ISO 8601). Sin zona se lee en hora de Chile.","schema":{"description":"Órdenes creadas desde esta fecha (ISO 8601). Sin zona se lee en hora de Chile.","type":"string"}},{"name":"created_until","in":"query","required":false,"description":"Órdenes creadas hasta esta fecha (ISO 8601). Una fecha sin hora cubre ese día completo.","schema":{"description":"Órdenes creadas hasta esta fecha (ISO 8601). Una fecha sin hora cubre ese día completo.","type":"string"}},{"name":"limit","in":"query","required":false,"description":"Cuántos traer como máximo, de 1 a 100. Por defecto 50.","schema":{"default":50,"description":"Cuántos traer como máximo, de 1 a 100. Por defecto 50.","type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"El next_cursor de la página anterior, tal cual llegó.","schema":{"description":"El next_cursor de la página anterior, tal cual llegó.","type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"short_code":{"type":"string"},"status":{"type":"string"},"payment_status":{"type":"string","enum":["fully_paid","partially_paid","pending"]},"created_at":{"type":"string"},"currency":{"type":"string","const":"CLP"},"total":{"type":"number"},"balance":{"type":"object","properties":{"remaining":{"type":"number"},"due_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"overdue":{"type":"boolean"}},"required":["remaining","due_at","overdue"],"additionalProperties":false},"is_quote":{"type":"boolean","const":true},"customer":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"rut":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["name","email","phone","rut","address","note"],"additionalProperties":false},"items":{"type":"array","items":{"type":"object","properties":{"product_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"is_cancelled":{"type":"boolean","const":true},"quantity":{"type":"number"},"unit_price":{"type":"number"},"options":{"type":"array","items":{"type":"string"}},"bookings":{"type":"array","items":{"type":"object","properties":{"starts_at":{"type":"string"},"ends_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["starts_at","ends_at"],"additionalProperties":false}},"answers":{"type":"array","items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"value":{"type":"string"}},"required":["label","value"],"additionalProperties":false}}},"package":{"anyOf":[{"type":"object","properties":{"weight_g":{"type":"number"},"width_cm":{"type":"number"},"height_cm":{"type":"number"},"depth_cm":{"type":"number"}},"required":["weight_g","width_cm","height_cm","depth_cm"],"additionalProperties":false},{"type":"null"}]}},"required":["product_id","code","name","quantity","unit_price","options","bookings","answers","package"],"additionalProperties":false}},"delivery":{"anyOf":[{"type":"object","properties":{"methods":{"type":"array","items":{"type":"string"}},"address":{"anyOf":[{"type":"object","properties":{"street":{"anyOf":[{"type":"string"},{"type":"null"}]},"number":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"comuna":{"anyOf":[{"type":"string"},{"type":"null"}]},"region":{"anyOf":[{"type":"string"},{"type":"null"}]},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["street","number","unit","comuna","region","reference"],"additionalProperties":false},{"type":"null"}]},"slot":{"anyOf":[{"type":"object","properties":{"date":{"type":"string"},"start":{"anyOf":[{"type":"string"},{"type":"null"}]},"end":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["date","start","end"],"additionalProperties":false},{"type":"null"}]},"shipping_cost":{"type":"number"},"tracking":{"anyOf":[{"type":"object","properties":{"company":{"anyOf":[{"type":"string"},{"type":"null"}]},"number":{"anyOf":[{"type":"string"},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["company","number","url"],"additionalProperties":false},{"type":"null"}]},"incidents":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["delivery_failed","returned"]},"at":{"type":"string"},"reason":{"type":"string"},"note":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["type","at","reason","note"],"additionalProperties":false}},"proof":{"anyOf":[{"type":"object","properties":{"at":{"type":"string"},"received_by":{"anyOf":[{"type":"string"},{"type":"null"}]},"photo_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"photos":{"type":"array","items":{"type":"string"}},"signature_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"pdf_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiver_rut":{"anyOf":[{"type":"string"},{"type":"null"}]},"driver_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"captured_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"lat":{"anyOf":[{"type":"number"},{"type":"null"}]},"lng":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["at","received_by","photo_url","note","photos","signature_url","pdf_url","receiver_rut","driver_name","captured_at","lat","lng"],"additionalProperties":false},{"type":"null"}]}},"required":["methods","address","slot","shipping_cost","tracking","incidents","proof"],"additionalProperties":false},{"type":"null"}]},"updated_at":{"type":"string"},"attribution":{"anyOf":[{"type":"object","properties":{"channel":{"type":"string"},"label":{"type":"string"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"medium":{"anyOf":[{"type":"string"},{"type":"null"}]},"campaign":{"anyOf":[{"type":"string"},{"type":"null"}]},"referrer":{"anyOf":[{"type":"string"},{"type":"null"}]},"landing":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["channel","label","source","medium","campaign","referrer","landing"],"additionalProperties":false},{"type":"null"}]}},"required":["id","short_code","status","payment_status","created_at","currency","total","customer","items","delivery","updated_at","attribution"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false},"example":{"data":[{"id":"kn7bczax9w1pagb2agzeeqwxx97y0ry2","short_code":"BCZAX9","status":"confirmed","payment_status":"fully_paid","created_at":"2026-11-19T15:04:05.000Z","currency":"CLP","total":25000,"customer":{"name":"Ana Rojas","email":"ana@example.com","phone":"+56911112222","rut":null,"address":null,"note":"Llego 10 minutos antes"},"items":[{"product_id":"jx7c1v2b3n4m5a6s7d8f9g0h1j2k3l4z","code":"P-7K2M9Q","name":"Clase de cerámica","quantity":2,"unit_price":12500,"options":["Con materiales"],"bookings":[{"starts_at":"2026-11-22T14:00:00.000Z","ends_at":"2026-11-22T16:00:00.000Z"}],"answers":[[{"label":"Nombre","value":"Ana Rojas"}],[{"label":"Nombre","value":"Luis Rojas"}]],"package":null}],"delivery":{"methods":["service-presencial"],"address":null,"slot":null,"shipping_cost":0,"tracking":null,"incidents":[],"proof":null},"updated_at":"2026-11-19T15:06:00.000Z","attribution":{"channel":"instagram","label":"Instagram · verano","source":"ig","medium":"social","campaign":"verano","referrer":"l.instagram.com","landing":"/mitienda"}}],"next_cursor":null}}}},"400":{"description":"Un parámetro tiene un valor que no sirve. El mensaje dice cuál.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Falta la API key, está mal escrita, fue revocada o venció.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"La key no tiene el permiso (scope) que pide el endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 120 llamadas en un minuto. Espera los segundos del header Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Falló algo de nuestro lado. Reintenta más tarde.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders/{id}":{"get":{"summary":"Una orden, con sus pagos.","description":"El id puede ser el id de la orden o su código corto (short_code, el que ve el comprador). payments trae solo los pagos que cuentan como recibidos: su suma es lo pagado. bookings son las sesiones reservadas de cada ítem y answers lo que respondió cada persona inscrita. Permiso: orders:read.","parameters":[{"name":"id","in":"path","required":true,"description":"Id de la orden o su short_code.","schema":{"type":"string","description":"Id de la orden o su short_code."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"short_code":{"type":"string"},"status":{"type":"string"},"payment_status":{"type":"string","enum":["fully_paid","partially_paid","pending"]},"created_at":{"type":"string"},"currency":{"type":"string","const":"CLP"},"total":{"type":"number"},"balance":{"type":"object","properties":{"remaining":{"type":"number"},"due_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"overdue":{"type":"boolean"}},"required":["remaining","due_at","overdue"],"additionalProperties":false},"is_quote":{"type":"boolean","const":true},"customer":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"rut":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["name","email","phone","rut","address","note"],"additionalProperties":false},"items":{"type":"array","items":{"type":"object","properties":{"product_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"is_cancelled":{"type":"boolean","const":true},"quantity":{"type":"number"},"unit_price":{"type":"number"},"options":{"type":"array","items":{"type":"string"}},"bookings":{"type":"array","items":{"type":"object","properties":{"starts_at":{"type":"string"},"ends_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["starts_at","ends_at"],"additionalProperties":false}},"answers":{"type":"array","items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"value":{"type":"string"}},"required":["label","value"],"additionalProperties":false}}},"package":{"anyOf":[{"type":"object","properties":{"weight_g":{"type":"number"},"width_cm":{"type":"number"},"height_cm":{"type":"number"},"depth_cm":{"type":"number"}},"required":["weight_g","width_cm","height_cm","depth_cm"],"additionalProperties":false},{"type":"null"}]}},"required":["product_id","code","name","quantity","unit_price","options","bookings","answers","package"],"additionalProperties":false}},"delivery":{"anyOf":[{"type":"object","properties":{"methods":{"type":"array","items":{"type":"string"}},"address":{"anyOf":[{"type":"object","properties":{"street":{"anyOf":[{"type":"string"},{"type":"null"}]},"number":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"comuna":{"anyOf":[{"type":"string"},{"type":"null"}]},"region":{"anyOf":[{"type":"string"},{"type":"null"}]},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["street","number","unit","comuna","region","reference"],"additionalProperties":false},{"type":"null"}]},"slot":{"anyOf":[{"type":"object","properties":{"date":{"type":"string"},"start":{"anyOf":[{"type":"string"},{"type":"null"}]},"end":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["date","start","end"],"additionalProperties":false},{"type":"null"}]},"shipping_cost":{"type":"number"},"tracking":{"anyOf":[{"type":"object","properties":{"company":{"anyOf":[{"type":"string"},{"type":"null"}]},"number":{"anyOf":[{"type":"string"},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["company","number","url"],"additionalProperties":false},{"type":"null"}]},"incidents":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["delivery_failed","returned"]},"at":{"type":"string"},"reason":{"type":"string"},"note":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["type","at","reason","note"],"additionalProperties":false}},"proof":{"anyOf":[{"type":"object","properties":{"at":{"type":"string"},"received_by":{"anyOf":[{"type":"string"},{"type":"null"}]},"photo_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"photos":{"type":"array","items":{"type":"string"}},"signature_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"pdf_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiver_rut":{"anyOf":[{"type":"string"},{"type":"null"}]},"driver_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"captured_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"lat":{"anyOf":[{"type":"number"},{"type":"null"}]},"lng":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["at","received_by","photo_url","note","photos","signature_url","pdf_url","receiver_rut","driver_name","captured_at","lat","lng"],"additionalProperties":false},{"type":"null"}]}},"required":["methods","address","slot","shipping_cost","tracking","incidents","proof"],"additionalProperties":false},{"type":"null"}]},"updated_at":{"type":"string"},"attribution":{"anyOf":[{"type":"object","properties":{"channel":{"type":"string"},"label":{"type":"string"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"medium":{"anyOf":[{"type":"string"},{"type":"null"}]},"campaign":{"anyOf":[{"type":"string"},{"type":"null"}]},"referrer":{"anyOf":[{"type":"string"},{"type":"null"}]},"landing":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["channel","label","source","medium","campaign","referrer","landing"],"additionalProperties":false},{"type":"null"}]},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"order_id":{"type":"string"},"order_short_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"method":{"type":"string"},"currency":{"type":"string","const":"CLP"},"amount":{"type":"number"},"fees":{"type":"object","properties":{"franky":{"type":"number"},"provider":{"type":"number"}},"required":["franky","provider"],"additionalProperties":false},"net_to_store":{"type":"number"},"paid_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","order_id","order_short_code","status","method","currency","amount","fees","net_to_store","paid_at"],"additionalProperties":false}}},"required":["id","short_code","status","payment_status","created_at","currency","total","customer","items","delivery","updated_at","attribution","payments"],"additionalProperties":false},"example":{"id":"kn7bczax9w1pagb2agzeeqwxx97y0ry2","short_code":"BCZAX9","status":"confirmed","payment_status":"fully_paid","created_at":"2026-11-19T15:04:05.000Z","currency":"CLP","total":25000,"customer":{"name":"Ana Rojas","email":"ana@example.com","phone":"+56911112222","rut":null,"address":null,"note":"Llego 10 minutos antes"},"items":[{"product_id":"jx7c1v2b3n4m5a6s7d8f9g0h1j2k3l4z","code":"P-7K2M9Q","name":"Clase de cerámica","quantity":2,"unit_price":12500,"options":["Con materiales"],"bookings":[{"starts_at":"2026-11-22T14:00:00.000Z","ends_at":"2026-11-22T16:00:00.000Z"}],"answers":[[{"label":"Nombre","value":"Ana Rojas"}],[{"label":"Nombre","value":"Luis Rojas"}]],"package":null}],"delivery":{"methods":["service-presencial"],"address":null,"slot":null,"shipping_cost":0,"tracking":null,"incidents":[],"proof":null},"updated_at":"2026-11-19T15:06:00.000Z","attribution":{"channel":"instagram","label":"Instagram · verano","source":"ig","medium":"social","campaign":"verano","referrer":"l.instagram.com","landing":"/mitienda"},"payments":[{"id":"k57e8r9t0y1u2i3o4p5a6s7d8f9g0h1j","order_id":"kn7bczax9w1pagb2agzeeqwxx97y0ry2","order_short_code":"BCZAX9","status":"completed","method":"bank_transfer","currency":"CLP","amount":25000,"fees":{"franky":250,"provider":300},"net_to_store":24450,"paid_at":"2026-11-19T15:06:00.000Z"}]}}}},"401":{"description":"Falta la API key, está mal escrita, fue revocada o venció.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"La key no tiene el permiso (scope) que pide el endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"La ruta no existe, o el recurso no existe en esta tienda.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 120 llamadas en un minuto. Espera los segundos del header Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Falló algo de nuestro lado. Reintenta más tarde.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders/{id}/status":{"post":{"summary":"Marcar una orden en preparación, en despacho (con seguimiento) o entregada, o avisar una entrega fallida o una devolución.","description":"Para la bodega o el operador de fulfillment. Solo avanza una orden pagada: no cancela ni reabre (eso lo decide la tienda). Con status shipping puedes mandar tracking (empresa, número y link): el comprador lo ve en su pedido. Con delivered puedes mandar proof (quién recibió, link a una foto, nota). delivery_failed (un intento de entrega que no resultó) y returned (el pedido volvió a la tienda) no cambian el estado: quedan anotados en delivery.incidents con su reason (obligatorio) y la tienda decide qué sigue. Un mismo aviso repetido en 10 minutos no se anota dos veces. Con notify_buyer: true Franky le avisa al comprador por correo y WhatsApp, igual que cuando la tienda cambia el estado (no aplica a delivery_failed ni returned). Responde la orden actualizada. Necesita una key con permiso orders:write (\"lectura y despacho\"). Permiso: orders:write.","parameters":[{"name":"id","in":"path","required":true,"description":"Id de la orden o su short_code.","schema":{"type":"string","description":"Id de la orden o su short_code."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["preparing","shipping","delivered","delivery_failed","returned"],"description":"preparing (en preparación), shipping (en despacho), delivered (entregado), delivery_failed (no se pudo entregar en este intento) o returned (devuelto a la tienda)."},"tracking":{"description":"Solo con shipping: empresa de despacho, número de seguimiento y link de seguimiento.","type":"object","properties":{"company":{"type":"string","maxLength":80},"number":{"type":"string","maxLength":80},"url":{"type":"string","maxLength":300,"format":"uri"}},"additionalProperties":false},"reason":{"description":"Obligatorio con delivery_failed y returned: el motivo, por ejemplo «No había nadie en el domicilio» o «Dirección no existe».","type":"string","maxLength":200},"note":{"description":"Con delivery_failed o returned: un detalle más (cuándo se reintenta, qué dijo el conserje).","type":"string","maxLength":500},"proof":{"description":"Solo con delivered: prueba de entrega. Quién recibió, link https a una foto y una nota.","type":"object","properties":{"received_by":{"type":"string","maxLength":120},"photo_url":{"type":"string","maxLength":500,"format":"uri"},"note":{"type":"string","maxLength":500}},"additionalProperties":false},"notify_buyer":{"description":"true: avisarle al comprador por correo y WhatsApp. Por defecto false.","type":"boolean"}},"required":["status"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"short_code":{"type":"string"},"status":{"type":"string"},"payment_status":{"type":"string","enum":["fully_paid","partially_paid","pending"]},"created_at":{"type":"string"},"currency":{"type":"string","const":"CLP"},"total":{"type":"number"},"balance":{"type":"object","properties":{"remaining":{"type":"number"},"due_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"overdue":{"type":"boolean"}},"required":["remaining","due_at","overdue"],"additionalProperties":false},"is_quote":{"type":"boolean","const":true},"customer":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"rut":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"string"},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["name","email","phone","rut","address","note"],"additionalProperties":false},"items":{"type":"array","items":{"type":"object","properties":{"product_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"is_cancelled":{"type":"boolean","const":true},"quantity":{"type":"number"},"unit_price":{"type":"number"},"options":{"type":"array","items":{"type":"string"}},"bookings":{"type":"array","items":{"type":"object","properties":{"starts_at":{"type":"string"},"ends_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["starts_at","ends_at"],"additionalProperties":false}},"answers":{"type":"array","items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"value":{"type":"string"}},"required":["label","value"],"additionalProperties":false}}},"package":{"anyOf":[{"type":"object","properties":{"weight_g":{"type":"number"},"width_cm":{"type":"number"},"height_cm":{"type":"number"},"depth_cm":{"type":"number"}},"required":["weight_g","width_cm","height_cm","depth_cm"],"additionalProperties":false},{"type":"null"}]}},"required":["product_id","code","name","quantity","unit_price","options","bookings","answers","package"],"additionalProperties":false}},"delivery":{"anyOf":[{"type":"object","properties":{"methods":{"type":"array","items":{"type":"string"}},"address":{"anyOf":[{"type":"object","properties":{"street":{"anyOf":[{"type":"string"},{"type":"null"}]},"number":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"comuna":{"anyOf":[{"type":"string"},{"type":"null"}]},"region":{"anyOf":[{"type":"string"},{"type":"null"}]},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["street","number","unit","comuna","region","reference"],"additionalProperties":false},{"type":"null"}]},"slot":{"anyOf":[{"type":"object","properties":{"date":{"type":"string"},"start":{"anyOf":[{"type":"string"},{"type":"null"}]},"end":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["date","start","end"],"additionalProperties":false},{"type":"null"}]},"shipping_cost":{"type":"number"},"tracking":{"anyOf":[{"type":"object","properties":{"company":{"anyOf":[{"type":"string"},{"type":"null"}]},"number":{"anyOf":[{"type":"string"},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["company","number","url"],"additionalProperties":false},{"type":"null"}]},"incidents":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["delivery_failed","returned"]},"at":{"type":"string"},"reason":{"type":"string"},"note":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["type","at","reason","note"],"additionalProperties":false}},"proof":{"anyOf":[{"type":"object","properties":{"at":{"type":"string"},"received_by":{"anyOf":[{"type":"string"},{"type":"null"}]},"photo_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"photos":{"type":"array","items":{"type":"string"}},"signature_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"pdf_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"receiver_rut":{"anyOf":[{"type":"string"},{"type":"null"}]},"driver_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"captured_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"lat":{"anyOf":[{"type":"number"},{"type":"null"}]},"lng":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["at","received_by","photo_url","note","photos","signature_url","pdf_url","receiver_rut","driver_name","captured_at","lat","lng"],"additionalProperties":false},{"type":"null"}]}},"required":["methods","address","slot","shipping_cost","tracking","incidents","proof"],"additionalProperties":false},{"type":"null"}]},"updated_at":{"type":"string"},"attribution":{"anyOf":[{"type":"object","properties":{"channel":{"type":"string"},"label":{"type":"string"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"medium":{"anyOf":[{"type":"string"},{"type":"null"}]},"campaign":{"anyOf":[{"type":"string"},{"type":"null"}]},"referrer":{"anyOf":[{"type":"string"},{"type":"null"}]},"landing":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["channel","label","source","medium","campaign","referrer","landing"],"additionalProperties":false},{"type":"null"}]},"payments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"order_id":{"type":"string"},"order_short_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"method":{"type":"string"},"currency":{"type":"string","const":"CLP"},"amount":{"type":"number"},"fees":{"type":"object","properties":{"franky":{"type":"number"},"provider":{"type":"number"}},"required":["franky","provider"],"additionalProperties":false},"net_to_store":{"type":"number"},"paid_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","order_id","order_short_code","status","method","currency","amount","fees","net_to_store","paid_at"],"additionalProperties":false}}},"required":["id","short_code","status","payment_status","created_at","currency","total","customer","items","delivery","updated_at","attribution","payments"],"additionalProperties":false},"example":{"id":"kn7bczax9w1pagb2agzeeqwxx97y0ry2","short_code":"BCZAX9","status":"shipping","payment_status":"fully_paid","created_at":"2026-11-19T15:04:05.000Z","currency":"CLP","total":25000,"customer":{"name":"Ana Rojas","email":"ana@example.com","phone":"+56911112222","rut":null,"address":null,"note":"Llego 10 minutos antes"},"items":[{"product_id":"jx7c1v2b3n4m5a6s7d8f9g0h1j2k3l4z","code":"P-7K2M9Q","name":"Clase de cerámica","quantity":2,"unit_price":12500,"options":["Con materiales"],"bookings":[{"starts_at":"2026-11-22T14:00:00.000Z","ends_at":"2026-11-22T16:00:00.000Z"}],"answers":[[{"label":"Nombre","value":"Ana Rojas"}],[{"label":"Nombre","value":"Luis Rojas"}]],"package":null}],"delivery":{"methods":["service-presencial"],"address":null,"slot":null,"shipping_cost":0,"tracking":null,"incidents":[],"proof":null},"updated_at":"2026-11-19T15:06:00.000Z","attribution":{"channel":"instagram","label":"Instagram · verano","source":"ig","medium":"social","campaign":"verano","referrer":"l.instagram.com","landing":"/mitienda"},"payments":[{"id":"k57e8r9t0y1u2i3o4p5a6s7d8f9g0h1j","order_id":"kn7bczax9w1pagb2agzeeqwxx97y0ry2","order_short_code":"BCZAX9","status":"completed","method":"bank_transfer","currency":"CLP","amount":25000,"fees":{"franky":250,"provider":300},"net_to_store":24450,"paid_at":"2026-11-19T15:06:00.000Z"}]}}}},"400":{"description":"Un parámetro tiene un valor que no sirve. El mensaje dice cuál.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Falta la API key, está mal escrita, fue revocada o venció.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"La key no tiene el permiso (scope) que pide el endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"La ruta no existe, o el recurso no existe en esta tienda.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 120 llamadas en un minuto. Espera los segundos del header Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Falló algo de nuestro lado. Reintenta más tarde.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/payments":{"get":{"summary":"Pagos recibidos, los más nuevos primero.","description":"Solo pagos confirmados de ventas, ordenados por fecha de pago. amount es lo que pagó el comprador, fees lo que se descontó (franky: comisión de Franky; provider: comisión del medio de pago) y net_to_store lo que recibe la tienda. method dice cómo se pagó: bank_transfer, card_credit, card_debit, cash o free. Los intentos de pago fallidos o pendientes no aparecen. Una página puede venir corta o vacía sin ser la última: sigue mientras next_cursor no sea null. Permiso: payments:read.","parameters":[{"name":"paid_since","in":"query","required":false,"description":"Pagos confirmados desde esta fecha (ISO 8601). Sin zona se lee en hora de Chile.","schema":{"description":"Pagos confirmados desde esta fecha (ISO 8601). Sin zona se lee en hora de Chile.","type":"string"}},{"name":"paid_until","in":"query","required":false,"description":"Pagos confirmados hasta esta fecha (ISO 8601). Una fecha sin hora cubre ese día completo.","schema":{"description":"Pagos confirmados hasta esta fecha (ISO 8601). Una fecha sin hora cubre ese día completo.","type":"string"}},{"name":"limit","in":"query","required":false,"description":"Cuántos traer como máximo, de 1 a 100. Por defecto 50.","schema":{"default":50,"description":"Cuántos traer como máximo, de 1 a 100. Por defecto 50.","type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"El next_cursor de la página anterior, tal cual llegó.","schema":{"description":"El next_cursor de la página anterior, tal cual llegó.","type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"order_id":{"type":"string"},"order_short_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"method":{"type":"string"},"currency":{"type":"string","const":"CLP"},"amount":{"type":"number"},"fees":{"type":"object","properties":{"franky":{"type":"number"},"provider":{"type":"number"}},"required":["franky","provider"],"additionalProperties":false},"net_to_store":{"type":"number"},"paid_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","order_id","order_short_code","status","method","currency","amount","fees","net_to_store","paid_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false},"example":{"data":[{"id":"k57e8r9t0y1u2i3o4p5a6s7d8f9g0h1j","order_id":"kn7bczax9w1pagb2agzeeqwxx97y0ry2","order_short_code":"BCZAX9","status":"completed","method":"bank_transfer","currency":"CLP","amount":25000,"fees":{"franky":250,"provider":300},"net_to_store":24450,"paid_at":"2026-11-19T15:06:00.000Z"}],"next_cursor":null}}}},"400":{"description":"Un parámetro tiene un valor que no sirve. El mensaje dice cuál.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Falta la API key, está mal escrita, fue revocada o venció.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"La key no tiene el permiso (scope) que pide el endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 120 llamadas en un minuto. Espera los segundos del header Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Falló algo de nuestro lado. Reintenta más tarde.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/products":{"get":{"summary":"Productos del catálogo.","description":"Todos los productos de la tienda, visibles o no (status active o inactive). kind dice qué es: product (producto), class (clase con horario), event (evento con fecha), appointment (servicio con hora) o quote (cotización). stock es null cuando el producto no lleva control de stock. price es el precio base; el de cada variante está en GET /products/{id}. Permiso: products:read.","parameters":[{"name":"status","in":"query","required":false,"description":"Solo los visibles (active) o solo los pausados (inactive).","schema":{"description":"Solo los visibles (active) o solo los pausados (inactive).","type":"string","enum":["active","inactive"]}},{"name":"limit","in":"query","required":false,"description":"Cuántos traer como máximo, de 1 a 100. Por defecto 50.","schema":{"default":50,"description":"Cuántos traer como máximo, de 1 a 100. Por defecto 50.","type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"El next_cursor de la página anterior, tal cual llegó.","schema":{"description":"El next_cursor de la página anterior, tal cual llegó.","type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["product","class","event","appointment","quote"]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"price":{"type":"number"},"currency":{"type":"string","const":"CLP"},"stock":{"anyOf":[{"type":"number"},{"type":"null"}]},"categories":{"type":"array","items":{"type":"string"}},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"url":{"type":"string"}},"required":["id","name","kind","status","price","currency","stock","categories","image_url","url"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false},"example":{"data":[{"id":"jx7c1v2b3n4m5a6s7d8f9g0h1j2k3l4z","name":"Polera Jardín","kind":"product","status":"active","price":14990,"currency":"CLP","stock":12,"categories":["Ropa"],"image_url":"https://img.franky.team/prod/images/1f2e3d4c-large.webp","url":"https://franky.link/jardinsecreto/p/polera-jardin-h1j2k3l4z"}],"next_cursor":"2"}}}},"400":{"description":"Un parámetro tiene un valor que no sirve. El mensaje dice cuál.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Falta la API key, está mal escrita, fue revocada o venció.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"La key no tiene el permiso (scope) que pide el endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 120 llamadas en un minuto. Espera los segundos del header Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Falló algo de nuestro lado. Reintenta más tarde.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/products/{id}":{"get":{"summary":"Un producto, con variantes y opciones.","description":"variants son las combinaciones que se venden por separado (talla, color), cada una con su precio y su stock. options son los grupos que el comprador elige al comprar (agregados), con cuántos puede elegir (min y max; max null es sin tope) y lo que suma cada opción al precio. Permiso: products:read.","parameters":[{"name":"id","in":"path","required":true,"description":"Id del producto.","schema":{"type":"string","description":"Id del producto."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["product","class","event","appointment","quote"]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"price":{"type":"number"},"currency":{"type":"string","const":"CLP"},"stock":{"anyOf":[{"type":"number"},{"type":"null"}]},"categories":{"type":"array","items":{"type":"string"}},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"url":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"price":{"type":"number"},"stock":{"anyOf":[{"type":"number"},{"type":"null"}]},"active":{"type":"boolean"}},"required":["id","name","price","stock","active"],"additionalProperties":false}},"options":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"min":{"type":"number"},"max":{"anyOf":[{"type":"number"},{"type":"null"}]},"choices":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"price":{"type":"number"},"stock":{"anyOf":[{"type":"number"},{"type":"null"}]},"active":{"type":"boolean"}},"required":["name","price","stock","active"],"additionalProperties":false}}},"required":["title","min","max","choices"],"additionalProperties":false}}},"required":["id","name","kind","status","price","currency","stock","categories","image_url","url","description","variants","options"],"additionalProperties":false},"example":{"id":"jx7c1v2b3n4m5a6s7d8f9g0h1j2k3l4z","name":"Polera Jardín","kind":"product","status":"active","price":14990,"currency":"CLP","stock":12,"categories":["Ropa"],"image_url":"https://img.franky.team/prod/images/1f2e3d4c-large.webp","url":"https://franky.link/jardinsecreto/p/polera-jardin-h1j2k3l4z","description":"Algodón orgánico, estampada a mano.","variants":[{"id":"k17a2b3c4d5e6f7g8h9j0k1m2n3p4q5r","name":"M · Verde","price":14990,"stock":7,"active":true},{"id":"k17z9y8x7w6v5u4t3s2r1q0p9n8m7k6j","name":"L · Verde","price":15990,"stock":5,"active":true}],"options":[{"title":"Envoltorio","min":0,"max":1,"choices":[{"name":"Para regalo","price":1500,"stock":null,"active":true}]}]}}}},"401":{"description":"Falta la API key, está mal escrita, fue revocada o venció.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"La key no tiene el permiso (scope) que pide el endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"La ruta no existe, o el recurso no existe en esta tienda.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 120 llamadas en un minuto. Espera los segundos del header Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Falló algo de nuestro lado. Reintenta más tarde.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/checkouts/preview":{"post":{"summary":"Qué pide una compra y cuánto cuesta, sin crearla.","description":"Paso 2 de «Vender desde tu app». Dile qué productos quiere el comprador y te devuelve el total, qué datos del comprador pide la tienda (customer_fields), qué opciones hay que elegir en cada producto (option_fields: talla, plan, agregados), cómo se puede recibir (delivery_options) y con qué medios se paga. ready es true cuando ya solo faltan los datos del comprador; si no, missing dice qué falta. No aparta stock ni crea nada. Los productos con horario (clases, eventos, servicios) y las cotizaciones todavía no se pueden comprar por la API. Permiso: checkouts:write.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"minItems":1,"maxItems":19,"type":"array","items":{"type":"object","properties":{"product_id":{"type":"string","minLength":1,"description":"Id del producto (el id de GET /products)."},"quantity":{"default":1,"description":"Cuántas unidades. Por defecto 1.","type":"integer","minimum":1,"maximum":99},"options":{"description":"Opciones elegidas, por nombre del grupo: { \"Talla\": \"M\" }. Las pide option_fields de /checkouts/preview.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["product_id","quantity"],"additionalProperties":false},"description":"Productos de la compra (sin horario)."},"delivery":{"description":"Id de la opción de entrega (delivery_options), o { <group>: <id> } si cada producto elige la suya.","anyOf":[{"type":"string"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}]},"address":{"description":"Dirección de despacho: street, number, unit, comuna, region, reference. Solo si la entrega es un despacho.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["items"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"anyOf":[{"type":"number"},{"type":"null"}]},"shipping":{"type":"number"},"currency":{"type":"string","const":"CLP"},"items":{"type":"array","items":{"type":"object","properties":{"product_id":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"unit_price":{"type":"number"}},"required":["product_id","name","quantity","unit_price"],"additionalProperties":false}},"customer_fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"required":{"type":"boolean"},"type":{"type":"string"},"options":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]}},"required":["key","label","required","type","options"],"additionalProperties":false}},"option_fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"required":{"type":"boolean"},"type":{"type":"string"},"options":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"product_id":{"type":"string"},"send_in":{"type":"string","enum":["items[].options","customer"]}},"required":["key","label","required","type","options","product_id","send_in"],"additionalProperties":false}},"delivery_options":{"type":"array","items":{"type":"object","properties":{"group":{"type":"string"},"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string","enum":["pickup","ship"]},"cost":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["group","id","label","kind","cost"],"additionalProperties":false}},"payment_methods":{"type":"array","items":{"type":"string","enum":["card","transfer"]}},"ready":{"type":"boolean"},"missing":{"type":"array","items":{"type":"string"}}},"required":["total","shipping","currency","items","customer_fields","option_fields","delivery_options","payment_methods","ready","missing"],"additionalProperties":false},"example":{"total":59960,"shipping":0,"currency":"CLP","items":[{"product_id":"jx7c1v2b3n4m5a6s7d8f9g0h1j2k3l4z","name":"Plan de comidas","quantity":2,"unit_price":29980}],"customer_fields":[{"key":"name","label":"Nombre","required":true,"type":"text","options":null},{"key":"email","label":"Email","required":true,"type":"email","options":null},{"key":"phone","label":"Teléfono","required":true,"type":"tel","options":null}],"option_fields":[{"key":"Plan","label":"Plan","required":true,"type":"select","options":["Mensual","Semanal"],"product_id":"jx7c1v2b3n4m5a6s7d8f9g0h1j2k3l4z","send_in":"items[].options"}],"delivery_options":[{"group":"g0","id":"in-store:k57abc","label":"Retiro: Local Valdivia","kind":"pickup","cost":0}],"payment_methods":["card","transfer"],"ready":true,"missing":[]}}}},"400":{"description":"Un parámetro tiene un valor que no sirve. El mensaje dice cuál.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Falta la API key, está mal escrita, fue revocada o venció.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"La key no tiene el permiso (scope) que pide el endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 120 llamadas en un minuto. Espera los segundos del header Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Falló algo de nuestro lado. Reintenta más tarde.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/checkouts":{"post":{"summary":"Crear la compra y recibir el link de pago.","description":"Paso 3 de «Vender desde tu app». Crea las órdenes como una compra en franky.link (aparta stock, manda los correos y WhatsApp al comprador, dispara los webhooks, descuenta la comisión) y devuelve payment_url: manda ahí al comprador. Cuando paga, Payku lo devuelve a success_url con ?checkout=<id>&status=paid|pending|failed. No confíes en esa URL para dar la compra por pagada: confirma con el webhook order.paid o con GET /checkouts/{id}. success_url es opcional: una dirección https de tu app (si la key tiene direcciones permitidas, debe ser una de ellas); sin success_url el comprador vuelve a la tienda en franky.link. customer lleva name, email y phone, más lo que pidió customer_fields (y las preguntas de option_fields con send_in customer). Un dato que falta o un correo mal escrito responde 400 con el mensaje; sin stock o sin cupo, 409 con code unavailable. Si no hay nada que pagar (total 0) payment_url es null y status paid. Permiso: checkouts:write.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"minItems":1,"maxItems":19,"type":"array","items":{"type":"object","properties":{"product_id":{"type":"string","minLength":1,"description":"Id del producto (el id de GET /products)."},"quantity":{"default":1,"description":"Cuántas unidades. Por defecto 1.","type":"integer","minimum":1,"maximum":99},"options":{"description":"Opciones elegidas, por nombre del grupo: { \"Talla\": \"M\" }. Las pide option_fields de /checkouts/preview.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["product_id","quantity"],"additionalProperties":false},"description":"Productos de la compra (sin horario)."},"customer":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Datos del comprador por clave: name, email, phone, rut si la tienda lo pide, y las respuestas de customer_fields."},"delivery":{"description":"Id de la opción de entrega (delivery_options), o { <group>: <id> } si cada producto elige la suya.","anyOf":[{"type":"string"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}]},"address":{"description":"Dirección de despacho: street, number, unit, comuna, region, reference. Solo si la entrega es un despacho.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"payment_method":{"default":"card","description":"card (tarjeta) o transfer (transferencia). Por defecto card.","type":"string","enum":["card","transfer"]},"success_url":{"description":"Dirección https de tu app a la que vuelve el comprador después de pagar. Sin ella, vuelve a la tienda en franky.link.","type":"string"}},"required":["items","customer"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","paid"]},"payment_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"number"},"currency":{"type":"string","const":"CLP"},"orders":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"short_code":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","short_code"],"additionalProperties":false}}},"required":["id","status","payment_url","total","currency","orders"],"additionalProperties":false},"example":{"id":"kh7b3c9d2e8f1a4g6h5j0k2m3n4p5q6r","status":"pending","payment_url":"https://checkout.payku.cl/payment/abc123","total":59960,"currency":"CLP","orders":[{"id":"jn71c9d2e8f1a4g6h5j0k2m3n4p5q6rs","short_code":"BCZAX9"}]}}}},"400":{"description":"Un parámetro tiene un valor que no sirve. El mensaje dice cuál.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Falta la API key, está mal escrita, fue revocada o venció.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"La key no tiene el permiso (scope) que pide el endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 120 llamadas en un minuto. Espera los segundos del header Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Falló algo de nuestro lado. Reintenta más tarde.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/checkouts/{id}":{"get":{"summary":"Estado de una compra creada con POST /checkouts.","description":"Úsalo cuando el comprador vuelve a tu app (o si el webhook order.paid no te llegó) para confirmar si pagó: status pending (esperando el pago), paid o failed (el pago se rechazó). id es el que devolvió POST /checkouts. Solo responde compras de tu tienda. Permiso: orders:read.","parameters":[{"name":"id","in":"path","required":true,"description":"El id que devolvió POST /checkouts.","schema":{"type":"string","description":"El id que devolvió POST /checkouts."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","paid","failed"]},"total":{"type":"number"},"currency":{"type":"string","const":"CLP"},"orders":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"short_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"}},"required":["id","short_code","status"],"additionalProperties":false}}},"required":["id","status","total","currency","orders"],"additionalProperties":false},"example":{"id":"kh7b3c9d2e8f1a4g6h5j0k2m3n4p5q6r","status":"paid","total":59960,"currency":"CLP","orders":[{"id":"jn71c9d2e8f1a4g6h5j0k2m3n4p5q6rs","short_code":"BCZAX9","status":"confirmed"}]}}}},"401":{"description":"Falta la API key, está mal escrita, fue revocada o venció.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"La key no tiene el permiso (scope) que pide el endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"La ruta no existe, o el recurso no existe en esta tienda.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Más de 120 llamadas en un minuto. Espera los segundos del header Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Falló algo de nuestro lado. Reintenta más tarde.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthorized","insufficient_scope","not_found","invalid_request","unavailable","rate_limited","payment_unavailable","internal"]},"message":{"type":"string"}}}}}}}}