This overview summarizes the Order with Google flow and how it interacts with your fulfillment web service.
The Order with Google 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
The next step is the cart validation stage where the resulting
by the user is processed by your web service.
Checkout action is the first call made by Google to your web service endpoint.
Your web service is responsible for the validation of the
Cart. You must
confirm the availability and pricing of items, compute and return taxes,
discounts, and fees, and validate the order delivery address.
The checkout process follows this sequence:
- The Order with Google service sends a
CheckoutRequestMessagethat contains a
Cartto your fulfillment web service endpoint.
- Your web service needs to validate the items in the
Cartbased on current prices, availability, and service providers. You then calculate the total price, which includes discounts, taxes, and delivery fees.
- Your endpoint responds with a
CheckoutResponseMessagethat contains 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 might choose to proceed to the order
submission stage of the flow.
Submit Order Action
The submit order action is triggered when the user places their order. Your web service must revalidate the cart, process the card token if online payments are enabled, and finally update the status of the order.
The order submission process follows this sequence:
- The Order with Google service sends a
SubmitOrderRequestMessagethat contains an
Orderto your fulfillment web service endpoint. Your backend needs to perform another
Cartvalidation before continuing.
Your web service processes the 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
SubmitOrderResponseMessagethat contains an
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 Order with Google user interface. You are required to send an order confirmation email to the user. Additionally, you use the Asynchronous Order Update API to send relevant order updates to Google.
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 that contains an
OrderUpdate. Google responds
The following illustration demonstrates how fulfillment actions interact with your web service. Click to enlarge.
Set up your fulfillment endpoint
The Order with Google actions use JSON messages to communicate with your web service and handle the processing, confirmation, and updates to food orders. When you design your Order with Google web service, you must define a URL endpoint that receives request messages from the Order with Google service and can return messages back to the Google service. Your implementation must meet the following requirements:
- Your web service must be able to receive a JSON message as a
POSTrequest from the Order with Google service.
- Your web service must provide a publicly accessible URL endpoint, called the fulfillment URL, which you specify in the Actions Console. The fulfillment URL is used to check out and submit orders. Your implementation must handle both types of requests.
- Your web service must be able to verify messages from Google using the Message verification method.
- Your implementation of the URL endpoint must be able to handle both checkout and order fulfillment with a single endpoint. You can't have one URL endpoint for checkout and a separate endpoint for ordering submission.
The client code generator in the Tools section is available to validate your web service against the Fulfillment API specification.