URL Templates For Payment Redirect

Upon booking an availability slot with a specific price, the user will be redirected to your booking page using a URL that's defined by you. The steps provided will show you how to do the following:

  1. Define your URL Template.
  2. Set your URL Template in your feeds.
  3. Enable linkout per availability slot.

1. Defining Your URL Template.

The uri template follows the Internet Engineering Task Force (IETF) RFC6570 Level 2 Uri Template specification, more details at datatracker.ietf.org The URL is set by you with parameters that are dynamically populated with information pertaining to that reservation. The following table includes required and optional parameters available for your uri template.

`https://reservation-provider.com/examplerestaurant/book?date={availability_slot_start_seconds}&num_guests={resources_party_size}`

Available Values for URL Template

Template Parameters Required / Optional Feed Field Example Value
availability_slot_start_seconds Required availability start_sec 4152695841
resources_party_size Required availability.resources party_size 2
availability_slot_availability_tag Optional availability availability_tag res-123
availability_slot_duration_seconds Optional availability duration_sec 3600
resources_room_id Optional availability.resources room_id bar_123

2. Set your URI Template in your feed.

The following section assumes you have a live E2E integration with an existing Service Feed. The URL that you've defined will be set in the Service feed, the following include the definition for that field.

message Service {
  // ..
  UriTemplate uri_template = 38;
}

Uri Template definition

// A template specifying how Google should generate URLs to external site.
message UriTemplate {
  // The uri template must follow the RFC6570, see
  // https://datatracker.ietf.org/doc/html/rfc6570.
  // Supports Level 2 templates.
  // These parameters will be resolved to their values specified in their
  // respective entities.
  //
  // 5 available parameters for Dining Reservation Linkout:
  // 1) (required) {availability_slot_start_seconds} :: populated from start_sec
  //   field in availability feed
  // 2) (required) {availability_slot_duration_seconds} :: populated from
  //   duration_sec field in availability feed
  // 3) (optional) {resources_party_size} :: populated from party_size field in
  //   availability feed
  // 4) (optional) {availability_availability_tag} :: populated from
  //   availability_tag field in availability feed
  // 5) (optional) {resources_room_id} :: populated from room_id field in
  //   availability feed
  //
  // Example usage:
  // http://example.com/book/restaurant?start={availability_slot_start_seconds}
  // &num_guests={resources_party_size}
  // * start_sec = 123456
  // * party_size = 2
  // https://example.com/book/restaurant?start=123456&num_guests=2
  string uri_template = 1;
}

Service Sample Definition

{
  "metadata": {
    "processing_instruction": "PROCESS_AS_COMPLETE",
    "shard_number": 0,
    "total_shards": 1,
    "nonce": "12484913",
    "generation_timestamp": 1530432018
  },
  "service": [
    {
      "merchant_id": "dining-A",
      "service_id": "reservation",
      "uri_template": {
        "uri_template": "https://reservation-provider.com/examplerestaurant/book?date={availability_slot_start_seconds}&num_guests={resources_party_size}"
      },
      "localized_service_name": {
        "value": "Reservation",
        "localized_value": [
          {
            "locale": "en",
            "value": "Reservation"
          }
        ]
      }
    }
  ]
}

The following section assumes you have a live E2E integration with an existing Availability Feed. Once you've set the URL template in your service feed, you will need to specify which of your availability slots will be required to linkout.

You can do so by adding the linkout_required_reason field with a value of PAYMENT_REQUIRED.

Linkout Reason Definition

message Availability {
  // ..
  LinkoutRequiredReason linkout_required_reason = 19;
}
  // The reason why a slot requires a linkout. Currently only used for Dining
  // Reservations Payment Redirect Partners.
  enum LinkoutRequiredReason {
    // Default value: Do not use, equates to unknown.
    LINKOUT_REQUIRED_REASON_UNSPECIFIED = 0;
    // Slot requires payment in the partner platform to be booked.
    PAYMENT_REQUIRED = 1;
  }

Linkout Reason Sample Definition

{
  "metadata": {
    "processing_instruction": "PROCESS_AS_COMPLETE",
    "shard_number": 0,
    "total_shards": 1,
    "nonce": "11203880",
    "generation_timestamp": 1543875200
  },
  "service_availability": [
    {
      "availability": [
        {
          "merchant_id": "dining-A",
          "service_id": "reservation",
          "linkout_required_reason": "PAYMENT_REQUIRED",
          "start_sec": 1535853600,
          "duration_sec": 2700,
          "spots_total": 2,
          "spots_open": 2,
          "resources": {
            "room_id": "A-dining-room",
            "room_name": "Dining Room",
            "party_size": 2
          }
        }
      ]
    }
  ]
}