Booking Rail Pass

Just as with booking tickets, when buying rail passes you create a booking and update the passenger details before collecting payment and finalizing the order.

After getting a PassBundle you create a Booking by calling createBooking.

Example: Create a booking with rail passes
graphql
query CreateBooking {
  createBooking(passBundle: "0f5c20ab-3d9f-414b-8d38-c8877cc9839c") {
    id
    passengers {
      id
      age
      type
    }
    requirements {
      countryOfResidence
      nationality
      dateOfBirth
      email
      tel
    }
    selection {
      ... on PassBundleSelection {
        class
        product
        price {
          amount
          currency
        }
        travelDayCount
        validityPeriod
      }
    }
  }
}
query CreateBooking {
  createBooking(passBundle: "dbe87043-c9a2-4326-b7b8-f51653bf85ac") {
    id
    passengers {
      id
      age
      type
    }
    requirements {
      countryOfResidence
      nationality
      dateOfBirth
      email
      tel
    }
    selection {
      ... on PassBundleSelection {
        class
        product
        price {
          amount
          currency
        }
        travelDayCount
        validityPeriod
      }
    }
  }
}

Updating Passengers

Before a booking can be confirmed you need to provide passenger details. The booking will include the PassengerRequirements for the passengers.

Contact person

At least one passenger needs to be marked as the contact person. The contact persons details will be forwarded to the train carrier and is the person that will be contacted in case of any issues.

Example: Updating passengers
graphql
mutation UpdatePassengers {
  updateBooking(
    id: "2b418311-1145-49d6-bce9-b5b9089f6b2f"
    passengers: [
      {
        id: "df70326a-4868-47ff-8eb4-6ab571e39aa7"
        email: "jane.doe@example.com"
        isContactPerson: true
        birthDate: "1980-02-15"
        nationality: "NL"
        firstName: "Jane"
        lastName: "Doe"
        title: MS
      }
    ]
  ) {
    id
    passengers {
      ... on FullPassenger {
        id
        isContactPerson
        email
        birthDate
        nationality
        firtName
        lastName
        title
      }
    }
  }
}
mutation UpdatePassengers {
  updateBooking(
    id: "2b418311-1145-49d6-bce9-b5b9089f6b2f"
    passengers: [
      {
        id: "df70326a-4868-47ff-8eb4-6ab571e39aa7"
        email: "jane.doe@example.com"
        isContactPerson: true
        birthDate: "1980-02-15"
        nationality: "NL"
        firstName: "Jane"
        lastName: "Doe"
        title: MS
      }
    ]
  ) {
    id
    passengers {
      ... on FullPassenger {
        id
        isContactPerson
        email
        birthDate
        nationality
        firtName
        lastName
        title
      }
    }
  }
}

Create Order

Once you have a booking with all the fares selected and passengers updated, you can create an order. There are two ways of creating an order; either by creating a payment or by manually creating an order. The latter is a privileged operation and requires a special commercial configuration.

Get Pass Codes

Once an order has been finalized passes are automatically issued. The issed pass code can be retrieved from the completed order. The pass code is then to be used in the respective pass provider services.

Pass issuing time

It may take 15 minutes or more for the passes to be issued and the codes are made available in the API.

Just like with all types that implement the Node interface, you can use the node query to fetch the an Order. See the details on how to query anything for more information.

Example: Get pass codes
graphql
query GetPassCodes {
  node(id: "62d0507e-1654-4ced-8a43-2de5e0fcb290") {
    ... on Order {
      items {
        ... on PassBundleOrderItem {
          passenger {
            firstName
            lastName
          }
          code
          class
          product
          travelDayCount
          validityPeriod
        }
      }
    }
  }
}
query GetPassCodes {
  node(id: "08305250-fafc-42ad-b8cc-46b315ca5a19") {
    ... on Order {
      items {
        ... on PassBundleOrderItem {
          passenger {
            firstName
            lastName
          }
          code
          class
          product
          travelDayCount
          validityPeriod
        }
      }
    }
  }
}