This overview summarizes the Food Ordering flow and how it interacts with your fulfillment web service.
The Food Ordering user interface handles all interactions with the user
as they add menu items to their order and decide on pickup or delivery,
depending on the services offered by the restaurant. This experience is powered
Menu entities found
in your data feeds.
The next step is the cart validation stage where the resulting
by the user is processed by your web service.
Cart validation is the first call made by Google to your web service endpoint.
Your web service is responsible for validating the
Cart by confirming
availability and pricing of items, computing and returning taxes, discounts,
and fees, and validating the order delivery address.
The checkout process follows this sequence:
- The Food Ordering service sends a
Cartto your fulfillment web service endpoint
- Your web service should validate the items in the
Cartbased on current prices, availability and service providers. You should then calculate the total price including discounts, taxes and delivery fees.
- Your endpoint responds with a
CheckoutResponseMessagecontaining the unmodified
Cartfor successful requests. A
FoodErrorExtensioncan be included in the
CheckoutResponseMessageto raise a processing error or propose minor changes, if necessary.
Cart is validated, the user may choose to proceed to the Order
submission stage of the flow.
The order submission stage is triggered when the user places their order. Your web service is responsible for re-validating the cart, processing the card token, if online payments are enabled, and finally updating the status of the order.
The order submission process follows this sequence:
- Food Ordering service sends a
Orderto your fulfillment web service endpoint. Your backend should again perform
Cartvalidation before continuing.
Your web service processes payment details found in the
Order, typically performing the following actions:
- Perform token verification, fraud and other eligibility checks
- Authorize and, optionally, charge the card
Your endpoint responds with a
OrderUpdatewith a state of
CREATED("Ordered" purchase status),
CONFIRMED("Accepted" purchase status), or
REJECTED("Declined" purchase status).
With the order placed, the user expects to receive order status updates from both you and the Food Ordering user interface. You are required to send an order confirmation email to the user. Additionally, you use Asynchronous Order Update Actions to send relevant order updates to your customers.
Asynchronous Order Update Action
Independent of any user notifications on your end, you must also send order status updates to Google for the following events:
- Changes to
OrderStatesuch as transitions from
- Changes to order items, such as price or availability
- Whenever the user triggers a support request from one of your customer support channels.
Updates are sent from your web service endpoint as an
AsyncOrderUpdateRequestMessage containing an
OrderUpdate. Google will
respond with an
The client code generator in the Tools section is available to validate your web service against the Fulfillment API specification.
This illustration demonstrates how fulfillment Actions interact with your web service. Click to enlarge.