Cambiar el estado de un pedido
curl --request PATCH \
--url https://app.fooddelivery.cl/api/v1/orders/{order_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://app.fooddelivery.cl/api/v1/orders/{order_id}"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://app.fooddelivery.cl/api/v1/orders/{order_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.fooddelivery.cl/api/v1/orders/{order_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.fooddelivery.cl/api/v1/orders/{order_id}"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://app.fooddelivery.cl/api/v1/orders/{order_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.fooddelivery.cl/api/v1/orders/{order_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": "#0041-150726",
"status": "pendiente_pago",
"type": "delivery",
"location_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {
"name": "<string>",
"phone": "<string>",
"email": "<string>"
},
"address": "<string>",
"items": [
{
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"quantity": 123,
"unit_price": 123,
"notes": "<string>",
"modifiers": [
{
"group": "<string>",
"name": "<string>",
"price": 123
}
]
}
],
"subtotal": 123,
"shipping_fee": 123,
"discount": 123,
"total": 123,
"payment": {
"method": "<string>",
"paid": true
},
"delivery": {
"provider": "uber",
"status": "<string>",
"tracking_url": "<string>"
},
"scheduled_for": "2023-11-07T05:31:56Z",
"next_day": true,
"created_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}Pedidos
Cambiar el estado de un pedido
Requiere permiso de escritura. Aplica las mismas reglas que la pantalla de cocina: solo transiciones legales del flujo (recibido → en_preparacion → listo → en_reparto → entregado; los pedidos de retiro saltan en_reparto), y cancelado desde cualquier estado no terminal. Marcar listo dispara el correo al cliente y el despacho automático del repartidor si corresponde (el pedido puede avanzar solo a en_reparto). Cancelar repone el stock automáticamente. Los pedidos gestionados por una integración POS (Toteat/Justo/Rockeat) no se pueden modificar (409 managed_by_integrator).
PATCH
/
orders
/
{order_id}
Cambiar el estado de un pedido
curl --request PATCH \
--url https://app.fooddelivery.cl/api/v1/orders/{order_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://app.fooddelivery.cl/api/v1/orders/{order_id}"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://app.fooddelivery.cl/api/v1/orders/{order_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.fooddelivery.cl/api/v1/orders/{order_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.fooddelivery.cl/api/v1/orders/{order_id}"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://app.fooddelivery.cl/api/v1/orders/{order_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.fooddelivery.cl/api/v1/orders/{order_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": "#0041-150726",
"status": "pendiente_pago",
"type": "delivery",
"location_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {
"name": "<string>",
"phone": "<string>",
"email": "<string>"
},
"address": "<string>",
"items": [
{
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"quantity": 123,
"unit_price": 123,
"notes": "<string>",
"modifiers": [
{
"group": "<string>",
"name": "<string>",
"price": 123
}
]
}
],
"subtotal": 123,
"shipping_fee": 123,
"discount": 123,
"total": 123,
"payment": {
"method": "<string>",
"paid": true
},
"delivery": {
"provider": "uber",
"status": "<string>",
"tracking_url": "<string>"
},
"scheduled_for": "2023-11-07T05:31:56Z",
"next_day": true,
"created_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>"
}
}Authorizations
Body
application/json
Response
Pedido actualizado (estado resultante tras efectos).
