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: "19f2aca4-a9ca-42a9-96e2-4517f79f2a5e") {
    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: "02e70f6a-b795-467e-a150-ddbdd9e255ba") {
    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: "eb296d69-fa39-4088-8c71-a54724632819"
    passengers: [
      {
        id: "27677bf9-7b27-4a28-a60b-4ff138231842"
        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: "eb296d69-fa39-4088-8c71-a54724632819"
    passengers: [
      {
        id: "27677bf9-7b27-4a28-a60b-4ff138231842"
        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: "13386a89-2097-4fbf-bf5a-2bdc14b1f5aa") {
    ... on Order {
      items {
        ... on PassBundleOrderItem {
          passenger {
            firstName
            lastName
          }
          code
          class
          product
          travelDayCount
          validityPeriod
        }
      }
    }
  }
}
query GetPassCodes {
  node(id: "b6bcdeba-c6d5-4968-aef6-fa0971ea75c7") {
    ... on Order {
      items {
        ... on PassBundleOrderItem {
          passenger {
            firstName
            lastName
          }
          code
          class
          product
          travelDayCount
          validityPeriod
        }
      }
    }
  }
}