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') {
// Process new order
console.log(`New order: ${event.metadata.id}`);
}
});
// Acknowledge immediately
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 com todos os detalhes do pedido (itens, pagamento, endereço, etc.). Retorna 404 para IDs inválidos, pedidos indisponíveis ou antigos.PLACED pode chegar antes dos detalhes. Se receber 404, implemente retry com exponential backoff por até 10 minutos. Não faça retentativas infinitas para evitar bloqueios.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"{
"events": [
{
"code": "CONFIRMED",
"orderId": "ord_456"
}
]
}{
"code": "CANCELLATION_REQUEST_FAILED",
"metadata": { "reason": "Insufficient inventory" }
}401 UnauthorizedorderId and timestamp for tracking.PLACED — Pedido criadoCONFIRMED — Pedido confirmadoPREPARATION_STARTED — Preparo iniciado (opcional)DISPATCHED — Saiu para entregaREADY_TO_PICKUP — Pronto para retiradaCONCLUDED — ConcluídoCANCELLED — CanceladoPLACED — Pedido criadoCONFIRMED — Pedido confirmadoREADY_TO_PICKUP — Pronto para retiradaDELIVERED — EntregueCONCLUDED — ConcluídoCANCELLED — CanceladoPLACED — Pedido criadoCONFIRMED — Pedido confirmadoDISPATCHED — Saiu para entregaCONCLUDED — ConcluídoCANCELLED — Cancelado| orderTiming | Descrição |
|---|---|
IMMEDIATE | Prepare e entregue o mais breve possível |
SCHEDULED | Respeite o horário agendado. Saiba mais sobre pedidos agendados |
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 and DINE_IN orders. Optional for DELIVERY with iFood driver.For merchant delivery, use /dispatch instead.Response (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 after delivery.ASSIGN_DRIVER event (driver assigned)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": "System error" },
{ "code": "502", "description": "Duplicate order" },
{ "code": "503", "description": "Item unavailable" }
// ... more codes
]
}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", // Success
"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 in order details.Response (200 OK):{ "valid": true }https://confirmacao-entrega-propria.ifood.com.br/phone.localizer) on receipt for reference.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": "Burger",
"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": "Courtesy refund"
}'/accept — Agree with cancellation/reject — Disagree with proposal/alternative — Offer refund or additional timeexpiresAt to respond. No response = automatic action (refund).Learn more: Negotiation Platform GuideCONCLUDED after:| Type | Immediate | Scheduled |
|---|---|---|
| Restaurant + iFood | Delivery or 6h | 6h after scheduling.to |
| Restaurant + Merchant | 4h | 4h after scheduling.to |
| Supermarket/Pharmacy | 13h | 13h after scheduling.to |
deliveryTimeInSeconds (store setting).You'll receive CONCLUDED event:{
"code": "CONCLUDED",
"orderId": "ord_456",
"createdAt": "2024-04-25T19:00:00Z"
}/acknowledgmentORDER_PATCHED