Merchants feed

message MerchantFeed {
  FeedMetadata metadata = 1;
  repeated Merchant merchant = 2;
}
// Info about a merchant that is on the aggregator's platform.
// A merchant feed should be a list of this message.
message Merchant {
  // An opaque string that uniquely identifies a merchant.
  // Strongly recommended to only include URL-safe characters. (required)
  string merchant_id = 1;
  // The name, telephone, url and geo are used to support matching partner
  // inventory with merchants already present on Google Maps. This information
  // will not be displayed.
  //
  // The name of the merchant. (required)
  string name = 2;
  // The contact telephone number of the merchant including its country and area
  // codes, e.g. +14567891234. Highly recommended. (optional)
  string telephone = 3;
  // The url of the merchant's public website. Highly recommended. (optional)
  string url = 4;
  // The Geo info of the merchant, including latitude, longitude, and address.
  // (required)
  GeoCoordinates geo = 5;
  // The category of the business in aggregator's platform. (required)
  // See https://developers.google.com/places/supported_types for possible
  // categories.
  string category = 6;
  // Number of bookings for this merchant in the trailing 30 days. (optional)
  int64 num_bookings_30d = 7;
  // This field is deprecated, please use tax_rate instead.
  uint32 tax_rate_basis_points = 8 [deprecated = true];

  // The merchant's tax rate. If present this field overrides the deprecated
  // tax_rate_basis_points field. An empty message (i.e. tax_rate { }) will
  // reset the applied tax rate to zero.
  //
  // This field is required for payments integration. (optional)
  TaxRate tax_rate = 9;

  // Restrictions to the payment methods this merchant accepts. We assume no
  // restrictions exist if this field is not set. (optional)
  PaymentRestrictions payment_restrictions = 10;

  // Payment options available for this merchant. Services under this merchant
  // will be able to individually limit the payment options they allow.
  // (optional)
  repeated PaymentOption payment_option = 11;

  // Configuration for a tokenized payment processor, if the merchant has
  // support for it. (optional)
  //
  // Deprecated. See the documentation for tokenization_config for current
  // methodology.
  PaymentProcessorConfig payment_processor_config = 12 [deprecated = true];

  // Configuration for a tokenized payment processor, if the merchant has
  // support for it.
  TokenizationConfig tokenization_config = 15;

  // The specific merchant's Terms and Conditions displayed to the user when a
  // service is being booked through Reserve with Google.
  // In addition to these the aggregator partner's Terms and Conditions are
  // always displayed to the user and must not be provided here. (optional)
  Terms terms = 13;

  // An opaque string that identifies the consumer-facing brand to use when
  // displaying partner attribution. This field allows partners with multiple
  // consumer-facing brands to provide merchants for all brands within the same
  // feed.
  //
  // A brand consists of consumer-facing properties like the name, logo, Terms
  // of Service, and Privacy Policy.
  //
  // If there is only one consumer-facing partner brand, this field does not
  // need to be set and can be ignored.
  //
  // If the partner...
  //
  //   Does not have multiple consumer-facing brands?
  //     --> Ignore this field
  //
  //   Has Multiple Brands that are configured?
  //
  //       If this field is set
  //         --> Associated consumer-facing brand attribution is used
  //
  //       If this field is unset or the empty string
  //         --> Default consumer-facing brand attribution is used
  //
  // Careful Note: most partners do not need to set this field. If a partner
  // wishes to use this field, they must contact us first to configure separate
  // brands, including the default brand.
  string brand_id = 14;

  // Hints to help Google match a merchant to a place on Google Maps.
  // Note: Typically, this field does not need to be set, as Google will match
  // merchants to places on Google Maps using the information provided above.
  // (optional)
  MerchantMatchingHints matching_hints = 16;

  // Definitions for any service attributes used to describe the Services for
  // this Merchant. (optional)
  repeated ServiceAttribute service_attribute = 17;
}
// The Geo data of a location, including latitude, longitude, and address.
message GeoCoordinates {
  double latitude = 1;        // In degrees. (optional)
  double longitude = 2;       // In degrees. (optional)

  // Address for a location, could either be structured or unstructured.
  oneof addresses {
    // Postal address of the location, preferred.
    PostalAddress address = 3;
    // An unstructured address could also be provided as a fallback.
    // E.g. "1600 amphitheatre parkway mountain view, ca 94043"
    string unstructured_address = 4;
  }
}
// The postal address for a merchant.
message PostalAddress {
  // The country, e.g. "USA". (required)
  string country = 1;
  // The locality/city, e.g. "Mountain View". (required)
  string locality = 2;
  // The region/state/province, e.g. "CA". (required)
  string region = 3;
  // The postal code, e.g. "94043". (required)
  string postal_code = 4;
  // The street address, e.g. "1600 Amphitheatre Pkwy". (required)
  string street_address = 5;
}
// A tax rate applied when charging the user for a service, and which can be set
// on either a per merchant, or per service basis.
message TaxRate {
  // A tax rate in millionths of one percent, effectively giving 6 decimals of
  // precision. For example, if the tax rate is 7.253%, this field should be set
  // to 7253000.
  //
  // If this field is left unset or set to 0, the total price charged to a user
  // for any service provided by this merchant is the exact price specified by
  // Service.price. The service price is assumed to be exempt from or already
  // inclusive of applicable taxes. Taxes will not be shown to the user as a
  // separate line item.
  //
  // If this field is set to any nonzero value, the total price charged to a
  // user for any service provided by this merchant will include the service
  // price plus the tax assessed using the tax rate provided here. Fractions of
  // the smallest currency unit (for example, fractions of one cent) will be
  // rounded using nearest even rounding. Taxes will be shown to the user as a
  // separate line item. (required)
  int32 micro_percent = 1;
}
// Restrictions to the credit card types this merchant accepts.
message CreditCardRestrictions {
  // A credit card type.
  enum CreditCardType {
    // Unused.
    CREDIT_CARD_TYPE_UNSPECIFIED = 0;

    // A Visa credit card.
    VISA = 1;

    // A Mastercard credit card.
    MASTERCARD = 2;

    // An American Express credit card.
    AMERICAN_EXPRESS = 3;

    // A Discover credit card.
    DISCOVER = 4;

    // A JCB credit card.
    JCB = 5;
  }
  // A list of supported credit cards. No credit cards are supported if empty.
  // (optional)
  repeated CreditCardType credit_card_type = 1;
}
// Restrictions to the payment methods this merchant accepts.
message PaymentRestrictions {
  // Restrictions to the credit cards this merchant accepts. We assume all
  // credit cards are accepted if this field is not set.
  // Note that the list of cards supported by CreditCardType will grow over
  // time, meaning that leaving this empty subjects a configuration to future
  // changes. (optional)
  CreditCardRestrictions credit_card_restrictions = 1;
}
// A payment option, which can be used to pay for services provided by a
// merchant. Payment options can be shared among multiple merchants
// (e.g. merchants belonging to the same chain).
message PaymentOption {
  // An opaque string from an aggregator partner to identify a payment option.
  //
  // This id is global to the whole aggregator, and re-using a value across
  // multiple merchants will allow a user to pay with the corresponding payment
  // option across those merchants.
  //
  // When re-using an id across multiple merchants, updating any value for a
  // payment option under one merchant will also update any other payment option
  // with the same id, under a different merchant. As such, it's a best practice
  // to have all payment options sharing the same id, always be updated to
  // identical values, to avoid any possibility of nondeterministic behavior.
  //
  // Do NOT confuse it with the internal payment option id. (required)
  string payment_option_id = 1;
  // The name of the payment option. This can be user visible. (required)
  string name = 2;
  // A description of the payment option. This can be user visible. (optional)
  string description = 3;
  // The price of the payment option. (required)
  Price price = 4;
  // The tax rate for this payment option. If present this field overrides the
  // tax_rate field present in the Merchant or Service. An empty message
  // (i.e. tax_rate { }) will reset the applied tax rate to zero. (optional)
  TaxRate tax_rate = 5;

  // A payment option type.
  enum PaymentOptionType {
    // Unused.
    PAYMENT_OPTION_TYPE_UNSPECIFIED = 0;
    // Payment option can only be used once.
    PAYMENT_OPTION_SINGLE_USE = 1;
    // Payment option can be used if its session count > 0.
    PAYMENT_OPTION_MULTI_USE = 2;
    // Payment option can be used within its valid time range - session count
    // is inapplicable.
    PAYMENT_OPTION_UNLIMITED = 3;
  }
  // The type of this payment option. Single-use for drop-ins, multi-use for
  // packs, and unlimited for memberships. (required)
  PaymentOptionType payment_option_type = 6;
  // How many sessions this payment option can be used for. Valid only for
  // multi-session / packs, where the value should be > 1.
  // (required if payment_option_type is PAYMENT_OPTION_MULTI_USE)
  int64 session_count = 7;
  // The payment option can be purchased within this interval. (optional)
  TimeRange purchase_interval = 8;
  // The payment option can be used within this interval (e.g. special price
  // for January 2017).
  // If present, this overrides valid_duration_sec and activation_type.
  // (optional)
  TimeRange valid_interval = 9;
  // Duration of the payment option validity (e.g. 30 day membership).
  // (optional)
  int64 valid_duration_sec = 10;

  // Defines how the validity start date is determined.
  enum ActivationType {
    // Unused.
    ACTIVATION_TYPE_UNSPECIFIED = 0;
    // Validity starts at the time of purchase.
    ACTIVATION_ON_PURCHASE = 1;
    // Validity starts when the payment option is used for the first time.
    ACTIVATION_ON_FIRST_USE = 2;
  }
  // Defines how the validity start date is determined for this payment option.
  // (required)
  ActivationType activation_type = 11;

  // Restricts the users eligible to purchase this payment option. Can be used
  // to restrict a promotional payment option to a subset of users. If not set,
  // all users are eligible. (optional)
  UserPurchaseRestriction user_restriction = 12;
}
message UserPurchaseRestriction {
  // A payment option that can only be purchased by users who have never
  // purchased from the same merchant before. (required if new_to_payment_option
  // is not set)
  bool new_to_merchant = 1;

  // A payment option that can only be purchased by users who have never
  // purchased the same payment option before. (required if new_to_payment is
  // not set)
  bool new_to_payment_option = 2;
}
// A closed-open time range, i.e. [begin_sec, end_sec)
message TimeRange {
  // Seconds of UTC time since Unix epoch (required)
  int64 begin_sec = 1;
  // Seconds of UTC time since Unix epoch (required)
  int64 end_sec = 2;
}
// A configuration for a payment processor, setup on a per Merchant basis.
message PaymentProcessorConfig {
  // Defines a specific payment processor partner.
  enum Processor {
    // Unused
    PROCESSOR_UNSPECIFIED = 0;

    // A configuration for payments with Stripe.
    PROCESSOR_STRIPE = 1;

    // A configuration for payments with Braintree.
    PROCESSOR_BRAINTREE = 2;
  }
  // Defines the payment processor partner this configuration applies to.
  // (required)
  Processor processor = 1;

  // The key used to identify this merchant with the payment processor.
  //
  // For Stripe, refer to: https://stripe.com/docs/dashboard#api-keys
  // For Braintree, refer to:
  // https://articles.braintreepayments.com/control-panel/important-gateway-credentials
  // (required)
  string public_key = 2;

  // The API version number sent to the payment processor along with payment
  // requests. (required)
  string version = 3;
}
// A configuration for payment-processor tokenization, set up on a per-Merchant
// basis.
message TokenizationConfig {
  // A tokenization configuration will typically have one
  // tokenization_parameter whose key is "gateway" and whose value is the
  // name of the processor.
  //
  // The rest of the parameters are dependent on the processor.  See
  // documentation from Google Pay and your processor for further information.
  // https://developers.google.com/pay/api/web/object-reference#PaymentMethodTokenizationSpecification
  // https://developers.google.com/pay/api/#participating-google-pay-processors
  //
  // Braintree example:
  // tokenization_parameter { key: "gateway" value: "braintree" }
  // tokenization_parameter { key: "braintree:apiVersion" value: "v1" }
  // tokenization_parameter { key: "braintree:sdkVersion" value: "2.30.0" }
  // tokenization_parameter { key: "braintree:merchantId" value: "abcdef" }
  // tokenization_parameter { key: "braintree:clientKey"
  //                          value: "production_xxx_yyy" }
  //
  // Stripe example:
  // tokenization_parameter { key: "gateway" value: "stripe" }
  // tokenization_parameter { key: "stripe:version" value: "2018-02-28" }
  // tokenization_parameter { key: "stripe:publishableKey" value: "pk_1234" }
  //
  // Adyen example:
  // tokenization_parameter { key: "gateway" value: "adyen" }
  // tokenization_parameter { key: "gatewayMerchantId" value: "yourId" }
  map<string, string> tokenization_parameter = 1;

  // The following field controls how much billing information to include in the
  // payment token. Verification of billing information is the responsibility of
  // Google Pay upon entry of Form Of Payment (FOP). If the FOP is currently in
  // Google Pay without the requested level of billing information, the user
  // will not see their FOP as a choice, and they will have to enter the FOP and
  // required information according to the current Google Pay UI.
  //
  // Some merchants like to keep the requested information minimal because
  // requesting more information can lead to lower conversion rates.
  //
  // Note that they can also go to payments.google.com to enhance an FOP but
  // most users will not know to do so.

  // How much of the Billing Address to require of the user and include in the
  // token. The enum values correspond to parameters in the Google Pay API (see
  // go/tnpqo).
  enum BillingInformationFormat {
    BILLING_INFORMATION_FORMAT_UNSPECIFIED = 0;
    // name, country code, and postal code (GPay default setting).
    MIN = 1;
    // name, street address, locality, region, country code, and postal code
    FULL = 2;
  }

  // Include in the payment token the user's billing information as entered into
  // Google Pay with their FOP (see above).
  BillingInformationFormat billing_information_format = 2;
}
// A set of rules and guidelines that are displayed to the
// user in order to make a booking through Reserve with Google.
message Terms {
  // The URL to the Terms and Conditions. (optional)
  string url = 1;

  // The text to be displayed to the user. (required)
  string text = 2;
}
// Hints used to help Google match a merchant to a place on Google Maps.
message MerchantMatchingHints {
  // The Place ID for a place in the Google Places database and on Google Maps.
  // See https://developers.google.com/places/place-id for more about Place IDs.
  // If this is provided, Google will match the merchant to this place.
  string place_id = 1;

  // ...
}
// Service attributes are partner-defined categories that describe the Services
// for a Merchant. For example, a bank may define an "Account Type"
// service attribute with possible values of "Personal" and "Business", while a
// hair salon may define a "Service Type" service attribute with possible
// values of "Haircut", "Color", and "Style".
message ServiceAttribute {
  // An identifier that uniquely identifies this service attribute among others
  // for the same merchant, e.g. "account-type".
  string attribute_id = 1;

  // A user-visible name for this attribute, e.g. "Account Type".
  string attribute_name = 2;

  // Represents a possible value for a particular service attribute.
  message Value {
    // An identifier that uniquely identifies this value among others for
    // this service attribute, e.g. "personal".
    string value_id = 1;

    // A user-visible name for the value, e.g. "Personal".
    string value_name = 2;
  }

  // All possible values for this service attribute.
  repeated Value value = 3;
}