Order specification

Order contains the information about a customer order, including information about each Line Item.

Order Definition

// An order for service appointments with a merchant.
message Order {
  // ID of this Order, chosen by the booking partner who handles the order
  // (required in CreateOrderResponse and ListOrdersResponse, must not be set in
  // CreateOrderRequest)
  string order_id = 1;
  // Personal information of the user making the order (required)
  UserInformation user_information = 2;
  // Information about payment transactions that relate to the Order.
  // (optional)
  PaymentInformation payment_information = 3;
  // The merchant that all services in this Order belong to.
  string merchant_id = 4;
  // Line items in this order.
  repeated LineItem item = 5;
}

LineItem Definition

// A single item in an Order--the booking of a single service in a single time
// slot.
message LineItem {
  // ID of the merchant Service. (required)
  string service_id = 1;
  // Start time of the appointment slot in seconds of UTC time since Unix epoch.
  // (required)
  int64 start_sec = 2;
  // Duration of the appointment slot in seconds. (required)
  int64 duration_sec = 3;

  message OrderedTickets {
    string ticket_id = 1;
    int32 count = 2;
  }
  // Number of tickets ordered by Ticket Type.
  repeated OrderedTickets tickets = 4;

  // The price should be updated to the correct value if the line item can be
  // fulfilled but the value from the request has changed. The updated price
  // should align with the enum in the 'warning_reason' field below, otherwise
  // the booking will be considered as failure. (required)
  Price price = 5;

  // Status of the Line Item. (required in CreateOrderResponse and
  // ListOrdersResponse; should not be set in requests)
  BookingStatus status = 6;

  // The user's answers to merchant questions for this services.
  // If there are both service level and per-ticket answers, this message will
  // be ordered with service level answers first and per-ticket answers after.
  // Will not be set in CheckOrderFulfillabilityRequest.
  IntakeFormAnswers intake_form_answers = 7;

  enum WarningReason {
    UNSPECIFIED_WARNING_REASON = 0;
    // This Line Item can be fulfilled and has increased in price.
    PRICE_INCREASE = 1;
    // This Line Item can be fulfilled and has decreased in price.
    PRICE_DECREASE = 2;
  }
  // If the total price is different from the price in the request, please use
  // this field to indicate a price change. The enum has to be aligned with the
  // actual price change, otherwise the booking will be considered as failure.
  WarningReason warning_reason = 8;
}

IntakeFormAnswers Definition

// User's answers to merchant questions.
message IntakeFormAnswers {
  repeated IntakeFormFieldAnswer answer = 1;
}

message IntakeFormFieldAnswer {
  // This id should be the same as the id of the corresponding question.
  string id = 1;

  // The response given by the user.
  // One string for MULTIPLE_CHOICE, DROPDOWN, SHORT_ANSWER, and PARAGRAPH
  // One string ("true" or "false") for BOOLEAN
  // One or more strings for CHECKBOXES.
  // For MULTIPLE_CHOICE, DROPDOWN or CHECKBOXES, the string would match exactly
  // one of the (possibly localized) strings sent by partner in choice_text in
  // the ServiceIntakeForm.
  // For LOCATION_SEARCH, the response could be:
  //   1. Matches one of the "location_id" in the "location" field in the
  //   service feed.
  //   2. User input answer containing location information that are not
  //   provided in the feed.
  repeated string response = 2;
}