logo
logo

Docs Shipping

Sending orders made on the iFood platform: This module allows merchants to send orders made on the iFood platform (Orders that already have an orderId). This is especially useful for merchants who have their own delivery people, but who may need the iFood delivery service in situations of overload or lack of delivery people. To use this service modality, it must be contracted through the Services menu of the Partner Portal. Otherwise, it will not be possible to register orders, check delivery availability, or request a delivery person.

Eligibility This delivery modality is not available for any order. The order will only be eligible when it meets some criteria such as:

  • The merchant is in a business model that allows this request (if the merchant is full service, the order is already delivered by our logistics and it is not possible to request a partner delivery person)
  • The order is for delivery (it is not possible to request for Pick Up orders)
  • The delivery area is covered by partner delivery people

Envio de pedidos realizados através de outros canais de venda: O módulo também permite que os merchants enviem pedidos que foram realizados através de outros canais de venda, como telefone, WhatsApp, aplicativo ou site próprio (Pedidos que não possuem um orderId pré-existente). Para maiores informações sobre o Sob Demanda, acesse https://news.ifood.com.br/entrega-facil-o-delivery-do-ifood-fora-do-app/

Sending orders made through other sales channels: The module also allows merchants to send orders that were made through other sales channels, such as telephone, WhatsApp, own app or website (Orders that do not have a pre-existing orderId). For more information about iFood Delivery, visit Sob Demanda out of iFood App

Definitions

Orders on the iFood platform and outside it

Orders on the iFood platform are those that already have an orderId, containing the necessary information from the restaurant and the customer to carry out the quote and request.

On the other hand, orders outside the iFood platform do not have a pre-existing orderId, as they are not originated internally. In this case, additional information is necessary to carry out the quote and request.

To use the module, Sob Demanda must be contracted through the Services menu on the Partner Portal. Otherwise, it will not be possible to register orders, check delivery availability or request a delivery person.

Requirements for Homologation

These criteria are applicable only for integrators who wish to integrate exclusively with the Shipping module when contracting delivery services for orders outside the iFood platform. For integrators who also wish to use the Orders module, the Orders homologation criteria applies. For those that are already homologated, it will not be required to do a new homologation in order to use the Shipping module.

  • Make requests on /polling endpoint regularly every 30 seconds;
  • Send /acknowledgment signal for every event received after a polling request;
  • Receive, confirm and dispatch an Sob Demanda order for now (orderType = DELIVERY / orderTiming = IMMEDIATE / salesChannel = POS);
  • Receive and cancel an order delivery for now (orderType = DELIVERY / orderTiming = IMMEDIATE / salesChannel = POS). It is mandatory to provide a list with all the codes/reasons for cancellation provided in the documentation;
  • Update the status of an order canceled by the customer or iFood;
  • Update the status of an order that may have been confirmed/canceled by another application such as Order Manager;
  • Receive the same event more than once in the polling and discard it if this event was delivered more than once;
  • Accept or reject an address change.
  • Should be able to check the delivery confirmation code and know if the code has been validated.
  • Should be able to check the collection code and know if the code has been validated.
  • The token renewing can only be performed when it's about to expire or immediately after it expires.
  • The application must respect the rate limit policies of each endpoint.
  • The printed tab should follow the model suggested in the documentation.
  • Display on the screen and/or printed tab where the delivery person should leave the order (which comes in the delivery.observations field)

Integration Flow

To integrate an order from outside iFood and request a delivery partner, you need to follow the following steps:

ClientAPI1- Delivery AvailabilityGET /deliveryAvailabilities?latitude={lat}&longitude={lon}Availability and Delivery window2- Order registrationPOST /ordersOrder IdClientAPI

Orders outside the iFood platform

ClientAPIPolling of Events1- Delivery AvailabilityGET /merchants/{merchantId}/deliveryAvailabilitiesAvailability and delivery windows2- Order RegistrationPOST /merchants/{merchantId}/ordersSends confirmation code eventOrder ID3- Order CancellationPOST /orders/{orderId}/cancelSends cancel order eventReturns accepted requestClientAPIPolling of Events

Before registering an order external to iFood, it is important to check the availability of delivery. It is possible that the address is not within the coverage area and even if the address is within the area, it is possible that there is some temporary unavailability in the region, such as a temporarily reduced delivery radius. Through this query it is also possible to obtain the estimated time window for the delivery of the order to inform the customer.

This step is not mandatory but querying this API before registering the order prevents errors from happening and allows the store to plan ahead the preparation of the order.

To check the logistics availability, just make the GET /deliveryAvailabilities request passing the following parameters:

  • merchantId - ID of the merchant that will request delivery
  • latitude - latitudinal coordinate of the delivery address
  • longitude - longitudinal coordinate of the delivery address
/shipping/v1.0/merchants/123f78cf-2879-44f7-92b7-1e4668dda999/deliveryAvailabilities?latitude=-23.455575&longitude=-46.669957

Success

This endpoint returns the http status code 200 OK if logistics are available. The response body contains:

  • id - quote id
  • expirationAt - quote expiration date and time UTC
  • createdAt - quote creation date and time UTC
  • quote.grossValue - gross delivery value
  • quote.discount - delivery discount value
  • quote.raise - increase value
  • quote.netValue - net delivery value
  • deliveryTime.min - minimum estimated delivery time in seconds
  • deliveryTime.max - maximum estimated delivery time in seconds
  • distance - delivery distance radius in meters (1000, 2000, 3000...)
  • preparationTime - preparation time
  • hasPaymentMethods - informs if there are available payment methods
  • Could not extract content from url: paymentMethods.id - payment method id
  • paymentMethods.brand - credit/debit card brand
  • paymentMethods.liability - responsible for receiving the payment (IFOOD)
  • paymentMethods.paymentType - type of payment e.g.: OFFLINE
  • paymentMethods.method - payment method CREDIT, DEBIT or CASH
{
  "id": "57cd1046-2e06-446f-a2dd-18a518212c3c",
  "expirationAt": "2023-08-18T19:49:06Z",
  "createdAt": "2023-08-17T19:49:06Z",
  "distance": 3000,
  "preparationTime": 60,
  "quote": {
    "grossValue": 7.99,
    "discount": 0,
    "raise": 0,
    "netValue": 7.99
  },
  "deliveryTime": {
    "min": 1200,
    "max": 1800
  },
  "hasPaymentMethods": true,
  "paymentMethods": [
    {
      "id": "21c65a8c-f29e-463f-b0bd-240edeb593c4",
      "brand": "CardBrand",
      "liability": "IFOOD",
      "paymentType": "OFFLINE",
      "method": "CREDIT"
    },
    {
      "liability": "IFOOD",
      "paymentType": "OFFLINE",
      "method": "CASH",
      "id": "93c1c7c7-61f1-4dd9-bb84-62a03254701d"
    }
  ]
}

Error

This endpoint returns the http status code 400 Bad Request if logistics are not available to deliver the order to this location or from that merchant’s location.

NameDescription
BadRequestModel validation
BadRequestMerchantPartner unavailable
DeliveryDistanceTooHighThe delivery address exceeds the logistics area served by iFood
OffOpeningHoursThe order is outside the operating hours of iFood logistics
OriginNotFoundWe do not yet deliver in your region, as your store is outside the iFood logistics area
ServiceAreaMismatchThe delivery address is outside our coverage area
HighDemandiFood logistics is temporarily unavailable. Please try again later
MerchantStatusAvailabilityRestaurant with pendency, call the Support
InvalidPaymentMethodsThe payment method chosen by the customer is not accepted by the iFood machine
{
  "code": "DeliveryDistanceTooHigh",
  "message": "Sob Demanda not available: the delivery address is more than 10 km from your store",
  "details": ["Delivery distance too high"]
}

This endpoint returns the http status code 500 Internal Server Error in case there is any failure to register this order.

NameDescription
InternalServerErrorInternal server error
{
  "code": "InternalServerError",
  "message": "Ops. There was a failure. Try again in a few moments.",
  "details": ["Internal server error"]
}

To register an order and request a partner delivery person, simply make the POST /orders passing the order information in the body.

Attention! A partner delivery person will be automatically allocated after successfully registering an order through this endpoint. If delivery is not possible, the order is not registered and an error is returned.

To ensure the security of deliveries and avoid cases of lost orders, a delivery confirmation code will be generated. This code consists of the last 4 digits of the end consumer's phone number provided in the order. The iFood delivery person will request this sequence of numbers when making the delivery.

I don't want my order to have a Delivery Confirmation Code

If you don't have access to the customer's phone number or don't want to provide it, you will need to send customer.phone.type="STORE" so that the delivery confirmation code is not requested.

For the order to have the delivery confirmation code enabled, the customer's phone number must be provided and this phone number must be valid, as only then will the customer be able to provide the correct delivery confirmation code to the iFood delivery person.

Attention! The end consumer must be informed that the iFood delivery person will request the confirmation code, and that this code refers to the last 4 digits of their phone number. If the consumer is not aware of the code at the time of delivery, the order will be canceled, resulting in a poor experience for the customer and losses for the restaurant.

Partners using the iFood tracking page

The confirmation code will be available on the iFood tracking page so that the end consumer can provide the correct code to the iFood delivery person.

Partners who do not use the iFood tracking page

To provide the confirmation code if you do not use the iFood tracking page, it will be necessary to consume the attribute metadata.CODE from the DELIVERY_DROP_CODE_REQUESTED event so that the code is passed on to the end consumer. This event will be propagated only in situations where the confirmation code is mandatory, therefore if the event is not sent, it means that delivery confirmation will not be necessary.

Attention! When the delivery confirmation code is validated, we will propagate the DELIVERY_DROP_CODE_VALIDATION_SUCCESS event. If this event is not sent, the code will not have been validated.

Below are all the order fields to be registered on iFood.

Note: Fields marked with an asterisk (*) are mandatory.

NameTypeDescription
customer*objectCustomer data.
customer.name*stringInforms the customer's name. Format: Free text, limited to 50 characters.
customer.phone*objectCustomer phone data.
customer.phone.typestringCustomer phone type. Possible values are STORE or CUSTOMER. If not send it will be CUSTOMER.
customer.phone.countryCode*stringSpecifies the country code. Format: A 2-digit number. Ex: 55. Not required if customer.phone.type STORE.
customer.phone.areaCode*stringInforms the area code of a location. Format: A 2-digit number. Ex: 41. Not required if customer.phone.type STORE.
customer.phone.Number*stringInforms the customer's phone number. Format: A 7 to 9 digit number Ex: 995663945. Not required if customer.phone.type STORE.
delivery*objectCustomer delivery data.
delivery.merchantFee*floatPartner billing fee
delivery.deliveryAddressobjectCustomer delivery address data.
delivery.deliveryAddress.postalCode*stringInforms the postal code of the customer's delivery address. Format: An 8-digit number. Ex: 82510290
delivery.deliveryAddress.streetNumber*stringInforms the customer’s delivery address number.
delivery.deliveryAddress.streetName*stringInforms the customer's street name. Format: Free, limited to 50 characters.
delivery.deliveryAddress.complementstringInforms the customer's complement (block, apartment, etc.). Format: Free, limited to 50 characters.
delivery.deliveryAddress.referencestringInforms the customer's reference pointFormat: Free, limited to 70 characters.
delivery.deliveryAddress.neighborhood*stringInforms the neighborhood of the customer's address. Format: Free, limited to 50 characters.
delivery.deliveryAddress.city*stringInforms the city of the customer's address. Format: Free, with a minimum of 2 and a maximum of 50 characters.
delivery.deliveryAddress.state*stringInforms the state of the customer's address. Format: Two letters, representing the acronym of the corresponding state. Ex: AZ
delivery.deliveryAddress.country*stringInforms the country of the customer's address. Format: Two letters Ex: US
delivery.deliveryAddress.coordinates*objectCoordinates data
delivery.deliveryAddress.coordinates.latitude*floatInforms the latitude of the customer's address.
delivery.deliveryAddress.coordinates.longitude*floatInforms the longitude of the customer's address.
items*array of objectsData for each order item.
items.id*uuidItem ID
items.name*stringInforms the name of the item Format: Free, limited to 50 characters.
items.externalCodestringItem code in your app
items.quantity*integerInforms the quantity of items. Value must be greater than zero.
items.unitPrice*floatRepresents the unit price of each item. Value must be greater than or equal zero.
items.optionsarray of objectsAdd-on data
items.options.id*uuidInforms the complement identifier
items.options.name*stringInforms the name of the add-on Format: Free, limited to 50 characters.
items.options.externalCodestringItem code in your app
items.options.index*integerInforms the index in the trim array.
items.options.quantity*integerInforms the quantity of that garnish.
items.options.unitPrice*floatInforms the unit price of the garnish.
items.options.price*floatInforms the total garnish price options.price = options.quantity * options.unitPrice.
items.price*floatInforms the total price of the product price = quantity * unitPrice. Value must be greater than or equal zero.
items.optionsPrice*floatInforms the total price of the garnishes. Value must be greater than or equal zero.
items.totalPrice*floatInforms the total price totalPrice = price + optionsPrice. Value must be greater than or equal zero.
paymentsobjectInforms the payment methods
payments.methodsarray of objectsPayment methods. Required if it's an OFFLINE payment
payments.methods.method*stringCREDIT, DEBIT or CASH (only one option)
payments.methods.type*stringPayment type i.e OFFLINE
payments.methods.value*floatAmount paid through the informed method
payments.methods.cardobjectCredit/debit card. Required if it's an CREDIT/DEBIT method
payments.methods.card.brand*stringCredit/debit card brand
payments.methods.cashobjectCash Payment. Required if it's an CASH method
payments.methods.cash.changeFor*floatValue in cash that the driver will receive.
displayIdstringFriendly ID to facilitate the identification of the order by the store and driver. Format: Up to 4 alphanumeric digits. Ex: A4BC
metadataobjectMetadata for additional information, required, order identification.Ex: M3019, idPDV501248, POS identifier Format: Limit of 20
metadata.prop1*Dictionary<string, string>Additional information

Examples

{
  "customer": {
    "name": "Customer Name",
    "phone": {
      "type": "CUSTOMER",
      "countryCode": "55",
      "areaCode": "11",
      "number": "999999999"
    }
  },
  "delivery": {
    "merchantFee": 0,
    "deliveryAddress": {
      "postalCode": "69923000",
      "streetNumber": "100",
      "streetName": "Ramal Bujari",
      "complement": "",
      "neighborhood": "Centro",
      "city": "Bujari",
      "state": "AC",
      "country": "BR",
      "reference": "Perto da padaria",
      "coordinates": {
        "latitude": -9.822159,
        "longitude": -67.948475
      }
    }
  },
  "items": [
    {
      "id": "7b956744-38f6-418a-90fa-22676b53e6d1",
      "name": "Produto Teste",
      "externalCode": "123456",
      "quantity": 1,
      "unitPrice": 1,
      "price": 1,
      "optionsPrice": 0,
      "totalPrice": 1,
      "options": []
    }
  ],
  "payments": {
    "methods": [
      {
        "method": "CREDIT",
        "type": "OFFLINE",
        "value": 1,
        "card": {
          "brand": "CardBrand"
        }
      }
    ]
  },
  "displayId" : "AB3D",
  "metadata": {
    "additionalProp1": "string"
  }
}

Payment Methods

Offline Payments the delivery person will receive the order amount upon delivery via iFood card machine or in cash depending on the sent method, it is necessary to send the payment object. It is necessary that the quote has this payment method in the list of paymentMethods, otherwise an error will be returned.

Online payments We do not process online payments, this payment is collected by the Merchant, so it is not necessary to send the payment object.

Metadata

The metadata field allows you to add supplementary information to the order. This information is not passed on to the driver's app or the order manager.

Success

This endpoint returns the http status code 202 Accepted if the order is successfully registered and the delivery partner is allocated without any problems. The response body contains:

  • id - ID of the created order
  • trackingUrl - url of the order tracking page
{
  "id": "522e4d7e-0ce1-44f3-8cc7-73a9f190a5e8",
  "trackingUrl": "https://meupedido.ifood.com.br/522e4d7e-0ce1-44f3-8cc7-73a9f190a5e8"
}

Are orders that are external to iFood made available in the polling?

Yes. The order that was registered to be delivered by one of the iFood delivery partners is processed by our infrastructure and made available in the Order API polling. The salesChannel="POS" field identifies orders that were imported and came from another acquisition channel.

Is it possible to track an order delivered by Sob Demanda?

Yes. After the order is successfully registered, the order ID is returned, which can be consulted in the tracking endpoint of the Order API.

Errors

This endpoint returns the http status code 400 Bad Request in case the logistics are not available to deliver the order or there is a failure to register this order.

NameDescription
BadRequestModel validation
BadRequestCustomerCustomer unavailable
BadRequestMerchantPartner unavailable
DeliveryDistanceTooHighThe delivery address exceeds the logistics area served by iFood
HighDemandiFood logistics is temporarily unavailable. Please try again later
MerchantEasyDeliveryDisabledThe service is not enabled
OffOpeningHoursThe order is outside the operating hours of iFood logistics
OriginNotFoundWe do not yet deliver in your region, as your store is outside the iFood logistics area
PaymentMethodNotFoundThe payment method chosen by the customer is not accepted by the iFood machine
PaymentTotalInvalidThe amount paid through the informed method does not match the total purchase value (the values of “value” and “totalPrice” do not match)
ServiceAreaMismatchThe delivery address is outside our coverage area
{
  "code": "DeliveryDistanceTooHigh",
  "message": "Sob Demanda not available: the delivery address is more than 10 km from your store",
  "details": ["Delivery distance too high"]
}

This endpoint returns the http status code 500 Internal Server Error if there is any failure to register this request.

NameDescription
InternalServerErrorInternal Server Error
{
  "code": "InternalServerError",
  "message": "Ops. There was a failure. Try again in a few moments.",
  "details": ["Internal server error"]
}

Through this flow, the customer can confirm their address or request a change to it. In cases where there is a change in the delivery address, a validation process will occur by the partner, where the approval or refusal of the request will be decided.

Customers who track their orders through the tracking page provided by iFood have the option to confirm the delivery address or request a change. For this to be possible, it is necessary that the order has not been created with the attribute customer.phone.type="STORE".

Tracking pageAPIClientCustomer confirms/requests address changeConfirmation/Request for address changeDAR/DAU EventDAR/DAU EventAcceptance/Rejection of the requestPartner accepts or rejects the address changeIn case of no action, automatic rejection after 15 minutesDAD/DAA EventCustomer views the result of the requestDAD/DAA EventTracking pageAPIClient

Attention! Make sure to send the correct customer phone number, used as WhatsApp, so that the change confirmation code (OTP) is sent. This procedure is essential to ensure the security of the partner, the customer, and the delivery.

Partners who choose to create their own experience of confirmation or request for change of delivery address must implement the endpoints responsible for this flow.

ClientAPI1 - Client confirms or requests address changeConfirmation/Request for address changeDAR/DAU EventAcceptance/Rejection of the request2 - Partner accepts or rejects the address change2.1 - In case of no action, automatic rejection after 15 minutesDAD/DAA EventClientAPI

Attention! In this flow, iFood does not perform any change confirmation process with the sending of an OTP code. The responsibility to validate and ensure this process is up to the partner.

To confirm the address, simply make the request POST /userConfirmAddress passing the following parameters:

  • orderId - ID of the order that will have the address confirmed
  /shipping/v1.0/orders/:orderId/userConfirmAddress

Responses

Success

This endpoint returns HTTP Status 202, with nothing in the response body The polling will receive an event of DELIVERY_ADDRESS_CHANGE_USER_CONFIRMED when the request is successful.

Error

This endpoint returns the http status code 400 Bad Request if the expected parameters are not provided.

NameDescription
BadRequestModel validation
{
  "code": "BadRequest",
  "message": "There was a problem reading the information. Check the information sent.",
  "details": [
  "Field 'OrderID' must be in uuid format."
  ]
}

This endpoint returns the http status code 404 Not Found if the order is not found, is completed or canceled, or was created more than 8 hours ago. | Name | Description | |---------------|-------------------------| | OrderNotFound | Order not found |

{
  "code": "OrderNotFound",
  "message": "Order not found.",
  "details": []
}

This endpoint returns the http status code 409 Operation Conflict if there is a conflict in the operation, such as trying to confirm the address of an order with pending/confirmed/denied change.

NameDescription
ChangeAddressOperationConflictConflict in address change operations.
{
  "code": "ChangeAddressOperationConflict",
  "message": "There is a conflict in the confirmation/request for address change of this order, it may already have the address confirmed by thecustomer, or a pending/completed change request",
  "details": []
}

This endpoint returns the http status code 500 Internal Server Error if there is any failure to register this order.

NameDescription
InternalServerErrorInternal server error

When a change of delivery address is requested, an event DELIVERY_ADDRESS_CHANGE_REQUESTED will be generated and sent via polling. This event indicates that the address change has been requested, and the new requested address will be available in the metadata.address attribute.

Important! After submitting the request for a change of delivery address, the partner will have up to 15 minutes to accept or deny the request. If no action is taken within this period, the request will be automatically denied.

To request an address change, simply make the request POST /deliveryAddressChangeRequest passing the following parameters:

The parameters marked with * are mandatory

  • orderId* the ID of the order that will have the address confirmed
  • streetName* the street name to which the address will be changed.
  • streetNumber the street number to which the address will be changed.
  • complement the complement of the address to which it will be changed.
  • reference the reference of the address to which it will be changed.
  • neighborhood* the neighborhood to which the address will be changed.
  • city* the city to which the address will be changed.
  • state* the state to which the address will be changed.
  • country* the country to which the address will be changed.
  • coordinates* the coordinates to which the address will be changed.
  • coordinates.latitude* the latitude to which the address will be changed.
  • coordinates.longitude* the longitude to which the address will be changed.
/shipping/v1.0/orders/:orderId/deliveryAddressChangeRequest

Responses

Success

This endpoint returns HTTP Status 202, with nothing in the response body

The polling will receive an event of DELIVERY_ADDRESS_CHANGE_REQUESTED when therequest is successful.

Error

This endpoint returns the http status code 400 Bad Request if the expected parameters are not provided.

NameDescription
BadRequestModel validation
MaxDistanceHigherThanAllowedIf the address change exceeds 500m.
{
  "code": "BadRequest",
  "message": "There was a problem reading the information. Check the information sent.",
  "details": [
    "Field 'StreetName' is mandatory.",
    "Field 'Neighborhood' is mandatory.",
    "Field 'City' is mandatory.",
    "Field 'State' is mandatory.",
    "Field 'Country' is mandatory.",
    "Field 'Latitude' is mandatory.",
    "Field 'Longitude' is mandatory."
  ]
}

This endpoint returns the http status code 404 Not Found if the order is not found, is completed or canceled, or was created more than 8 hours ago.

NameDescription
OrderNotFoundOrder not found
{
  "code": "OrderNotFound",
  "message": "Order not found.",
  "details": []
}

This endpoint returns the http status code 409 Operation Conflict if there is a conflict in the operation, such as trying to confirm the address of an order with pending/confirmed/denied change.

NameDescription
ChangeAddressOperationConflictConflict in address change operations.
{
  "code": "ChangeAddressOperationConflict",
  "message": "There is a conflict in the confirmation/request for address change of this order, it may already have the address confirmed by the customer, or a pending/completed change request",
  "details": []
}

This endpoint returns the http status code 500 Internal Server Error if there is any failure to register this order.

NameDescription
InternalServerErrorInternal server error

To approve the address change, simply make the request POST /acceptDeliveryAddressChange passing the following parameters:

  • orderId - ID of the order that will have the delivery address changed
/shipping/v1.0/orders/:orderId/acceptDeliveryAddressChange

Responses

Success

This endpoint returns HTTP Status 202, with nothing in the response body The polling will receive an event of DELIVERY_ADDRESS_CHANGE_ACCEPTED when the request is successful.

Error

This endpoint returns the http status code 400 Bad Request if the expected parameters are not provided.

When the error name is RegionMismatch an DELIVERY_ADDRESS_CHANGE_DENIED event will be sent with the action="region-mismatch"

NameDescription
BadRequestModel validation
RegionMismatchThe new address is not in the same region as the original
{
  "code": "BadRequest",
  "message": "There was a problem reading the information. Check the information sent.",
  "details": [
    "Field 'OrderID' must be in uuid format."
  ]
}

This endpoint returns the http status code 404 Not Found if the order is not found, is completed or canceled, or was created more than 8 hours ago.

NameDescription
OrderNotFoundOrder not found
{
  "code": "OrderNotFound",
  "message": "Order not found.",
  "details": []
}

This endpoint returns the http status code 409 Operation Conflict if there is a conflict in the operation, such as trying to confirm the address of an order with pending/confirmed/denied change.

NameDescription
ChangeAddressOperationConflictConflict in address change operations.
ChangeAddressOperationNotStartedThere is no pending address change.
{
  "code": "ChangeAddressOperationConflict",
  "message": "There is a conflict in the confirmation/request for address change of this order, it may already have the address confirmed by the customer, or a pending/completed change request",
  "details": []
}

This endpoint returns the http status code 500 Internal Server Error if there is any failure to register this order.

NameDescription
InternalServerErrorInternal server error

To deny the address change, simply make the request POST /denyDeliveryAddressChange passing the following parameters:

  • orderId - ID of the order that will have the address change request denied
/shipping/v1.0/orders/:orderId/denyDeliveryAddressChange

Responses

Success

This endpoint returns HTTP Status 202, with nothing in the response body The polling will receive an event of DELIVERY_ADDRESS_CHANGE_DENIED when the request is successful.

Error

This endpoint returns the http status code 400 Bad Request if the expected parameters are not provided.

NameDescription
BadRequestModel validation
{
  "code": "BadRequest",
  "message": "There was a problem reading the information. Check the information sent.",
  "details": [
    "Field 'OrderID' must be in uuid format."
  ]
}

This endpoint returns the HTTP status code 404 Not Found if the order is not found, is completed or cancelled, or was created more than 8 hours ago.

NameDescription
OrderNotFoundOrder not found
{
  "code": "OrderNotFound",
  "message": "Order not found.",
  "details": []
}

This endpoint returns the HTTP status code 409 Operation Conflict if there is a conflict in the operation, such as trying to confirm the address of an order with a pending/confirmed/rejected change.

NameDescription
ChangeAddressOperationConflictConflict in address change operations.
ChangeAddressOperationNotStartedThere is no pending address change.
{
  "code": "ChangeAddressOperationConflict",
  "message": "There is a conflict in the confirmation/request for address change of this order, it may already have the address confirmed by the customer, or a pending/completed change request",
  "details": []
}

This endpoint returns the HTTP status code 500 Internal Server Error if there is a failure to register this order.

NameDescription
InternalServerErrorInternal server error

To cancel a delivery request for orders that are not from the iFood platform, it is crucial to understand some conditions. Firstly, only orders with the salesChannel attribute set as POS can be cancelled. Any order that does not fit this context cannot be cancelled through the Shipping module.

To get the list of valid cancellation codes for an order, you can use the endpoint GET /cancellationReasons.

To perform the cancellation, you must make a request to the endpoint POST /cancel, passing the following parameters:

  • orderID - Order Id
  • reason - Text with the description of the reason
  • cancellationCode - Cancellation code
/shipping/v1.0/orders/<orderId>/cancel

Sucesso

This endpoint returns HTTP Status 202, with nothing in the response body The polling will receive a CANCELLATION_REQUESTED event when the request is successful and subsequently the CANCELLED or CANCELLATION_REQUEST_FAILED events in case of success or failure.

Erro

This endpoint returns the http status code 400 Bad Request if the expected parameters are not provided.

NameDescription
BadRequestModel validation
{
  "code": "BadRequest",
  "message": "There was a problem reading information. Check the information sent.",
  "details": [
    "Field 'OrderID' must be in uuid format."
  ]
}

This endpoint returns the http status code 500 Internal Server Error if there is a failure when requesting the delivery cancellation.

NameDescription
InternalServerErrorInternal server error
{
  "code": "InternalServerError",
  "message": "Oops. There was a failure. Try again in a few moments.",
  "details": ["Internal server error"]
}

To enhance the security of your delivery, we have developed a set of rules that allow us to qualify the level of confidence in the delivery. This qualification is based on the parameters informed during the creation of the order and on the change or confirmation of the address made by the customer after the creation of the order.

We will have the following levels of confidence in delivery

NomeDescrição
LOWLow
MODERATEModerate
HIGHHigh
VERY_HIGHVery high

The calculation of the delivery confidence level will be based on the following rules

NameDescription
customer_phone_valid(The informed phone is different from customer.phone.type="STORE") and (they are not only repeated numbers or numbers in sequence (ex: 123456789)) and (the phone has more than 11 digits).
customer_phone_is_fixedThe phone is a landline with 8 digits.
customer_address_confirmedThe delivery address was confirmed by the end customer.
customer_address_change_requestedThe customer requested a change of the delivery address.
customer_address_change_approvedThe partner approved the change of the delivery address.
customer_address_change_deniedThe partner rejected the change of the delivery address.

Exemplos de como ficariam os níveis de confiança na entrega:

Order with customer_phone_is_valid:false will have a LOW score.

Order with customer_phone_is_fixed:true will have a MODERATE score.

Order with customer_phone_is_fixed:true and customer_address_confirmed:true will have a VERY_HIGH score.

Order with customer_phone_is_valid:true will have a HIGH score.

Order with customer_phone_is_valid:true and customer_address_change_requested:true and merchant_address_change_approved:true will have a VERY_HIGH score.

Order with customer_phone_is_valid:true and customer_address_change_requested:true and merchant_address_change_denied:true will have a LOW score.

The delivery confidence level can be changed after the order is created. Actions taken after the order is created, such as confirming the address or requesting a change of address, have a direct impact on the delivery confidence level.

To find out the level of confidence in the delivery of your order, just send the GET /safeDelivery request passing the following parameters.

  • orderId - ID of the order that will have the delivery security level consulted.
/shipping/v1.0/orders/:orderId/safeDelivery

Respostas

Sucesso

This endpoint returns the http status code 200 OK if the order is eligible for delivery security. The response body contains:

  • rules - contains a map of the type [string]boolean containing the rule and situation.
  • score - level of confidence in the delivery of the order generated based on the rules defined in the rules field.
{
	"rules": {
		"customer_address_change_requested": false,
		"customer_address_confirmed": false,
		"customer_phone_is_fixed": false,
		"customer_phone_valid": true,
		"merchant_address_change_approved": false,
		"merchant_address_change_denied": false
	},
	"score": "HIGH"
}
Erro

This endpoint returns the http status code 400 Bad Request if the expected parameters are not provided.

NameDescription
BadRequestModel validation
OrderWithoutSafeDeliveryOrder does not have delivery confidence rules

BadRequest

{
  "code": "BadRequest",
  "message": "There was a problem reading information. Check the information sent.",
  "details": [
    "Field 'OrderID' must be in uuid format."
  ]
}

OrderWithoutSafeDelivery

{
  "code": "OrderWithoutSafeDelivery",
  "message": "Order without delivery confidence rules.",
  "details": []
}

This endpoint returns the http status code 404 Not Found if the order is not found.

NomeDescrição
OrderNotFoundOrder not found
{
  "code": "OrderNotFound",
  "message": "Order not found.",
  "details": []
}

Este endpoint retorna o http status code 500 Internal Server Error caso ocorra alguma falha ao consultar esse pedido.

NomeDescrição
InternalServerErrorErro interno do servidor
{
  "code": "InternalServerError",
  "message": "Oops. There was a failure. Please try again in a few moments.",
  "details": ["Internal server error"]
}

Orders on the iFood platform

ClientAPIPolling of Events1- Delivery AvailabilityGET /orders/{orderId}/deliveryAvailabilitiesAvailability and delivery windows2- Order RegistrationPOST /orders/{orderId}/requestDriverSends request driver eventOrder ID3- Delivery CancellationPOST /orders/{orderId}/cancelRequestDriverSends cancel request driver eventReturns accepted requestClientAPIPolling of Events

Before registering a delivery request, it is important to consult the quote/delivery availability. It is possible that the address is not within the coverage area and even if the address is within the area, there may be some temporary unavailability in the region, such as temporarily reduced delivery radius. Through this consultation, it is also possible to obtain the estimated time window for the order delivery to inform the customer.

This step is not mandatory, but performing the consultation before registering the order prevents errors from occurring and allows the store to plan the preparation of the order.

To consult the logistics quote for a pre-existing order within the iFood platform, just make the request GET /deliveryAvailabilities passing the following parameters:

  • orderId - ID of the order already existing on the iFood platform to request delivery
/shipping/v1.0/orders/<orderId>/deliveryAvailabilities

Sucesso

This endpoint returns the http status code 200 OK if logistics are available. The response body contains:

  • id - quote id
  • expirationAt - quote expiration date and time UTC
  • createdAt - quote creation date and time UTC
  • quote.grossValue - gross delivery value
  • quote.discount - delivery discount value
  • quote.raise - increase value
  • quote.netValue - net delivery value
  • deliveryTime.min - minimum estimated delivery time in seconds
  • deliveryTime.max - maximum estimated delivery time in seconds
  • distance - delivery distance radius in meters (1000, 2000, 3000...)
  • preparationTime - preparation time
  • hasPaymentMethods - informs if there are available payment methods
  • paymentMethods.id - payment method id
  • paymentMethods.brand - credit/debit card brand
  • paymentMethods.liability - responsible for receiving the payment (IFOOD)
  • paymentMethods.paymentType - type of payment e.g.: OFFLINE
  • paymentMethods.method - payment method CREDIT or DEBIT
{
  "id": "57cd1046-2e06-446f-a2dd-18a518212c3c",
  "expirationAt": "2023-08-18T19:49:06Z",
  "createdAt": "2023-08-17T19:49:06Z",
  "distance": 3000,
  "preparationTime": 60,
  "quote": {
    "grossValue": 7.99,
    "discount": 0,
    "raise": 0,
    "netValue": 7.99
  },
  "deliveryTime": {
    "min": 1200,
    "max": 1800
  },
  "hasPaymentMethods": true,
  "paymentMethods": [
    {
      "id": "21c65a8c-f29e-463f-b0bd-240edeb593c4",
      "brand": "CardBrand",
      "liability": "IFOOD",
      "paymentType": "OFFLINE",
      "method": "CREDIT"
    }
  ]
}

Erro

This endpoint returns the http status code 400 Bad Request if logistics are not available to deliver the order at this location or for this merchant.

NameDescription
BadRequestModel validation
BadRequestMerchantPartner unavailable
DeliveryDistanceTooHighThe delivery address exceeds the logistics area served by iFood
OffOpeningHoursThe order is outside the operating hours of iFood logistics
OriginNotFoundWe do not yet deliver in your region, as your store is outside the iFood logistics area
ServiceAreaMismatchThe delivery address is outside our coverage area
HighDemandiFood logistics is temporarily unavailable. Please try again later
MerchantStatusAvailabilityRestaurant with pendency, call the Support
InvalidPaymentMethodsThe payment method chosen by the customer is not accepted by the iFood machine
SaturatedOfflinePaymentAt the moment, the pay on delivery option is unavailable
{
  "code": "DeliveryDistanceTooHigh",
  "message": "iFood Delivery unavailable: the delivery address is more than 10 Km from your store.",
  "details": ["Delivery distance too high"]
}

This endpoint returns the http status code 500 Internal Server Error if there is a failure when registering this order.

NomeDescrição
InternalServerErrorInternal server error
{
  "code": "InternalServerError",
  "message": "Oops. There was a failure. Try again in a few moments.",
  "details": ["Internal server error"]
}

To request the delivery person agreeing with the returned quote, use the following endpoint POST /requestDriver passing in the body the order information.

This endpoint is asynchronous. When your request is processed you will receive a REQUEST_DRIVER event confirming that the request has been made and then the result of the request, which can be: REQUEST_DRIVER_SUCCES or REQUEST_DRIVER_FAILED.

Attention! A partner delivery person will be automatically allocated after the request through this endpoint. If it is not possible to make the delivery, the delivery request is not registered and an error is returned.

  • orderId - ID of the order already existing on the iFood platform to request delivery
  • quoteId - ID of the quote previously requested to request delivery
/shipping/v1.0/orders/<orderId>/requestDriver

Success

This endpoint returns the http status code 202 Accepted if the request is successfully registered.

Errors

This endpoint returns the http status code 400 Bad Request if logistics are not available to deliver the order or there is a failure when registering this order.

NameDescription
BadRequestModel validation
BadRequestCustomerCustomer unavailable
BadRequestMerchantPartner unavailable
DeliveryDistanceTooHighThe delivery address exceeds the logistics area served by iFood
HighDemandiFood logistics is temporarily unavailable. Please try again later
MerchantEasyDeliveryDisabledThe service is not enabled
OffOpeningHoursThe order is outside the operating hours of iFood logistics
OriginNotFoundWe do not yet deliver in your region, as your store is outside the iFood logistics area
ServiceAreaMismatchThe delivery address is outside our coverage area
MerchantStatusAvailabilityRestaurant with pendency, call the Support
InvalidPaymentMethodsThe payment method chosen by the customer is not accepted by the iFood machine
SaturatedOfflinePaymentAt the moment, the pay on delivery option is unavailable
{
  "code": "DeliveryDistanceTooHigh",
  "message": "iFood Delivery unavailable: the delivery address is more than 10 Km from your store.",
  "details": ["Delivery distance too high"]
}

This endpoint returns the http status code 500 Internal Server Error if there is a failure when registering this order.

NomeDescrição
InternalServerErrorInternal server error
{
  "code": "InternalServerError",
  "message": "Oops. There was a failure. Try again in a few moments.",
  "details": ["Internal server error"]
}

To cancel the request for an iFood delivery person without the need to cancel the order, the delivery cancellation must be performed through the endpoint POST /orders/{id}/cancelRequestDriver.

The cancellation will only be carried out if it is requested before the delivery person's acceptance, in this case no fee will be charged from the store. If it is necessary to cancel after the delivery person's acceptance, the rules established in Order Cancellation must be followed.

The endpoint is asynchronous. When your request is processed, the store will receive a DELIVERY_CANCELLATION_REQUEST_ACCEPTED event, in case of success, or DELIVERY_CANCELLATION_REQUEST_REJECTED, in case of failure. See all the details of these events in this section.

Important The action is irreversible. After canceling the request for a delivery person, it will not be possible to reverse this service. For a new delivery person to be requested, a new delivery person request must be made.

/shipping/v1.0/orders/<orderId>/cancelRequestDriver

Success

This endpoint returns HTTP Status 202, with nothing in the response body The polling will receive a DELIVERY_CANCELLATION_REQUESTED event when the request is successfully sent.

Error

This endpoint returns the http status code 400 Bad Request if the expected parameters are not provided.

NameDescription
BadRequestModel validation
{
  "code": "BadRequest",
  "message": "There was a problem reading information. Check the information sent.",
  "details": [
    "Field 'OrderID' must be in uuid format."
  ]
}

This endpoint returns the http status code 500 Internal Server Error if there is a failure when requesting the delivery cancellation.

NameDescription
InternalServerErrorInternal server error
{
  "code": "InternalServerError",
  "message": "Oops. There was a failure. Try again in a few moments.",
  "details": ["Internal server error"]
}