Fulfillment overview

This overview summarizes the Food Ordering flow and how it interacts with your fulfillment web service.

Ordering

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 by the Restaurant, Service and Menu entities found in your data feeds.

The next step is the cart validation stage where the resulting Cart created by the user is processed by your web service.

Cart validation

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:

  1. The Food Ordering service sends a CheckoutRequestMessage containing a Cart to your fulfillment web service endpoint
  2. Your web service should validate the items in the Cart based on current prices, availability and service providers. You should then calculate the total price including discounts, taxes and delivery fees.
  3. Your endpoint responds with a CheckoutResponseMessage containing the unmodified Cart for successful requests. A FoodErrorExtension can be included in the CheckoutResponseMessage to raise a processing error or propose minor changes, if necessary.

Once the Cart is validated, the user may choose to proceed to the Order submission stage of the flow.

Order submission

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:

  1. Food Ordering service sends a SubmitOrderRequestMessage containing an Order to your fulfillment web service endpoint. Your backend should again perform Cart validation before continuing.
  2. Your web service processes payment details found in the Order, typically performing the following actions:

    1. Perform token verification, fraud and other eligibility checks
    2. Authorize and, optionally, charge the card
  3. Your endpoint responds with a SubmitOrderResponseMessage containing an OrderUpdate with 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:

  1. Changes to OrderState such as transitions from CREATED to CONFIRMED, and CONFIRMED to IN_TRANSIT.
  2. Changes to order items, such as price or availability
  3. 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 AsyncOrderUpdateResponseMessage.

Client Libraries

The client code generator in the Tools section is available to validate your web service against the Fulfillment API specification.

Sequence diagram

This illustration demonstrates how fulfillment Actions interact with your web service. Click to enlarge.

Food Ordering fulfillment flow