curl -X GET "https://merchant-api.ifood.com.br/order/v1.0/orders:polling" \
-H "Authorization: Bearer YOUR_TOKEN"{
"events": [
{
"id": "evt_123",
"code": "CONFIRMED",
"fullCode": "ORDER_CONFIRMED",
"orderId": "ord_456",
"createdAt": "2024-04-25T18:00:00Z",
"metadata": {
"id": "ord_456",
"status": "CONFIRMED",
"category": "FOOD",
"orderType": "DELIVERY",
"items": [...]
}
}
]
}const express = require('express');
const app = express();
app.post('/webhooks/orders', express.json(), (req, res) => {
const { events } = req.body;
events.forEach(event => {
if (event.code === 'CONFIRMED') {
// Procesar nuevo pedido
console.log(`Nuevo pedido: ${event.metadata.id}`);
}
});
// Confirmar inmediatamente
res.status(200).json({ acknowledged: true });
});
app.listen(3000);/acknowledgment.curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/orders:acknowledgment" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"acknowledgedEventIds": ["evt_123", "evt_124"]
}'curl -X GET "https://merchant-api.ifood.com.br/order/v1.0/orders/{id}" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"200 con todos los detalles del pedido (artículos, pago, dirección, etc.). Retorna 404 para IDs inválidos, pedidos no disponibles o antiguos.PLACED puede llegar antes de los detalles. Si recibe 404, implemente reintentos con exponential backoff hasta 10 minutos. No haga reintentos infinitos para evitar bloqueos.displayId)curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/orders/ord_456/confirm" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"# Siguiente polling retornará:
{
"events": [
{
"code": "CONFIRMED", // Éxito
"orderId": "ord_456"
}
]
}
# O en caso de fallo:
{
"events": [
{
"code": "CANCELLATION_REQUEST_FAILED", // Rechazo
"orderId": "ord_456",
"metadata": {
"reason": "Inventario insuficiente"
}
}
]
}orderId y timestamp de confirmación para auditoría.curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/orders/{id}/confirm" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"202 Accepted.curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/orders/{id}/startPreparation" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"202 Accepted.curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/orders/{id}/dispatch" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/orders/{id}/readyToPickup" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json"202 Accepted.curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/orders/ord_456/readyToPickup" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"TAKEOUT y DINE_IN. Opcional para DELIVERY con conductor iFood.Para entrega propia, use /dispatch en su lugar.Respuesta (202 Accepted)curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/orders/ord_456/dispatch" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "deliveredBy": "MERCHANT" }'CONCLUDED después de entrega.ASSIGN_DRIVER (conductor asignado)curl -X GET "https://merchant-api.ifood.com.br/order/v1.0/orders/ord_456/tracking" \
-H "Authorization: Bearer YOUR_TOKEN"{
"latitude": -23.5505,
"longitude": -46.6333,
"expectedDelivery": "2024-04-25T18:30:00Z",
"pickupEtaStart": 120,
"deliveryEtaEnd": 600,
"trackDate": "2024-04-25T18:15:00Z"
}curl -X GET "https://merchant-api.ifood.com.br/order/v1.0/orders/ord_456/cancellationReasons" \
-H "Authorization: Bearer YOUR_TOKEN"{
"reasons": [
{ "code": "501", "description": "Error en el sistema" },
{ "code": "502", "description": "Pedido duplicado" },
{ "code": "503", "description": "Artículo no disponible" }
// ... más códigos
]
}curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/orders/ord_456/requestCancellation" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"reason": "503"
}'{
"events": [
{
"code": "CANCELLED", // Éxito
"orderId": "ord_456"
}
]
}curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/orders/ord_456/validatePickupCode" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"code": "123456"
}'pickupCode en detalles del pedido.Respuesta (200 OK):{ "valid": true }https://confirmacao-entrega-propria.ifood.com.br/phone.localizer) en recibo como referencia.curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/orders/ord_456/verifyDeliveryCode" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"code": "654321"
}'{ "valid": true }CONCLUDED.{
"events": [
{
"code": "ORDER_PATCHED",
"orderId": "ord_456",
"metadata": {
"changeType": "DELETE_ITEMS",
"items": [
{
"id": "item_789",
"name": "Hamburguesa",
"quantity": 1
}
]
}
}
]
}curl -X POST "https://merchant-api.ifood.com.br/order/v1.0/disputes/dispute_123/accept" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"reason": "CUSTOMER_SATISFACTION",
"detailReason": "Reembolso por cortesía"
}'/accept — Concordar con cancelamiento/reject — Desacuerdo con propuesta/alternative — Ofrecer reembolso o tiempo adicionalexpiresAt para responder. Sin respuesta = acción automática (reembolso).Aprenda más: Guía Plataforma de NegociaciónCONCLUDED después:| Tipo | Inmediato | Programado |
|---|---|---|
| Restaurante + iFood | Entrega o 6h | 6h después scheduling.to |
| Restaurante + Propio | 4h | 4h después scheduling.to |
| Supermercado/Farmacia | 13h | 13h después scheduling.to |
deliveryTimeInSeconds (configuración tienda).Recibirá evento CONCLUDED:{
"code": "CONCLUDED",
"orderId": "ord_456",
"createdAt": "2024-04-25T19:00:00Z"
}/acknowledgmentORDER_PATCHED