Coverage API

Order

An order is a purchased product for an itinerary.

Create an order for a quoted product

Creates an order for one product of a quote, at the price it was quoted at.

Responds 201 Created with the new order. Retrying with the same Idempotency-Key and the same body responds 200 OK with that order in its current status, so a timed out request is safe to retry.

An order of a partner settled by invoice is booked at once and has no expires_at. Any other order starts created and must be paid through POST /order/{order_id}/payment_session before expires_at.

POST
/order
apikey<token>

In: header

Header Parameters

idempotency-keyIdempotency-Key

Client generated key. Reuse it to retrieve the same order on retry.

Length16 <= length <= 128
itineraryItinerary

The itinerary that was quoted

languageLanguage

ISO 639-1 language code

Match^[a-z]{2}$
product_codeProductCode

code of the quoted product

Value in"protected" | "travel_sure"
quoted_pricePrice

price of the quoted product

contactContact

The purchaser

Response Body

curl -X POST "https://api.staging.dohop.io/coverage/v1/order" \  -H "idempotency-key: stringstringstri" \  -H "Content-Type: application/json" \  -d '{    "itinerary": {      "outbound": {        "flights": [          {            "flight_number": "string",            "origin": "string",            "destination": "string",            "departure": "2019-08-24T14:15:22Z",            "arrival": "2019-08-24T14:15:22Z"          }        ]      },      "number_of_passengers": 1    },    "language": "string",    "product_code": "protected",    "quoted_price": {      "amount": 0,      "currency": "string"    },    "contact": {      "email": "user@example.com",      "phone": "string",      "first_name": "string",      "last_name": "string"    }  }'
{
  "order_id": "string",
  "status": "created",
  "product": {
    "code": "protected",
    "price": {
      "amount": 0,
      "currency": "string"
    },
    "terms_url": "string"
  },
  "itinerary": {
    "outbound": {
      "flights": [
        {
          "flight_number": "string",
          "origin": "string",
          "destination": "string",
          "departure": "2019-08-24T14:15:22Z",
          "arrival": "2019-08-24T14:15:22Z"
        }
      ]
    },
    "homebound": {
      "flights": [
        {
          "flight_number": "string",
          "origin": "string",
          "destination": "string",
          "departure": "2019-08-24T14:15:22Z",
          "arrival": "2019-08-24T14:15:22Z"
        }
      ]
    },
    "number_of_passengers": 1
  },
  "contact": {
    "email": "user@example.com",
    "phone": "string",
    "first_name": "string",
    "last_name": "string"
  },
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z"
}
{
  "errors": [
    {
      "status_text": "Incomplete",
      "error_code": "string",
      "response_code": 0,
      "description": "string",
      "recoverable": true
    }
  ]
}
{
  "errors": [
    {
      "status_text": "Incomplete",
      "error_code": "string",
      "response_code": 0,
      "description": "string",
      "recoverable": true
    }
  ]
}
{
  "errors": [
    {
      "status_text": "Incomplete",
      "error_code": "string",
      "response_code": 0,
      "description": "string",
      "recoverable": true
    }
  ]
}
{
  "errors": [
    {
      "status_text": "Incomplete",
      "error_code": "string",
      "response_code": 0,
      "description": "string",
      "recoverable": true
    }
  ]
}

Get an order

Returns the order in its current status.

An unpaid order reads as expired once expires_at passes. A payment authorised before then still books the order, so an order that reads as expired while payment_in_progress can later read as booked.

GET
/order/{order_id}
apikey<token>

In: header

Path Parameters

order_idOrder Id

Response Body

curl -X GET "https://api.staging.dohop.io/coverage/v1/order/string"
{
  "order_id": "string",
  "status": "created",
  "product": {
    "code": "protected",
    "price": {
      "amount": 0,
      "currency": "string"
    },
    "terms_url": "string"
  },
  "itinerary": {
    "outbound": {
      "flights": [
        {
          "flight_number": "string",
          "origin": "string",
          "destination": "string",
          "departure": "2019-08-24T14:15:22Z",
          "arrival": "2019-08-24T14:15:22Z"
        }
      ]
    },
    "homebound": {
      "flights": [
        {
          "flight_number": "string",
          "origin": "string",
          "destination": "string",
          "departure": "2019-08-24T14:15:22Z",
          "arrival": "2019-08-24T14:15:22Z"
        }
      ]
    },
    "number_of_passengers": 1
  },
  "contact": {
    "email": "user@example.com",
    "phone": "string",
    "first_name": "string",
    "last_name": "string"
  },
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z"
}
{
  "errors": [
    {
      "status_text": "Incomplete",
      "error_code": "string",
      "response_code": 0,
      "description": "string",
      "recoverable": true
    }
  ]
}
{
  "errors": [
    {
      "status_text": "Incomplete",
      "error_code": "string",
      "response_code": 0,
      "description": "string",
      "recoverable": true
    }
  ]
}
{
  "errors": [
    {
      "status_text": "Incomplete",
      "error_code": "string",
      "response_code": 0,
      "description": "string",
      "recoverable": true
    }
  ]
}

Cancel an order

Cancels a booked order and responds with it as cancelled. An invoiced order is credited on your invoice; a paid order has its charge reversed in full.

An order can be cancelled only while nothing has happened on it: Dohop support is not handling the order, its first flight has not departed, and none of its flights is cancelled or delayed by more than three hours. Otherwise the request is rejected with 409 Conflict and the order stays booked; contact Dohop support to cancel it.

POST
/order/{order_id}/cancel
apikey<token>

In: header

Path Parameters

order_idOrder Id
reasonReason

Why the order is cancelled, recorded on the cancellation

Length1 <= length <= 200

Response Body

curl -X POST "https://api.staging.dohop.io/coverage/v1/order/string/cancel" \  -H "Content-Type: application/json" \  -d '{    "reason": "string"  }'
{
  "order_id": "string",
  "status": "created",
  "product": {
    "code": "protected",
    "price": {
      "amount": 0,
      "currency": "string"
    },
    "terms_url": "string"
  },
  "itinerary": {
    "outbound": {
      "flights": [
        {
          "flight_number": "string",
          "origin": "string",
          "destination": "string",
          "departure": "2019-08-24T14:15:22Z",
          "arrival": "2019-08-24T14:15:22Z"
        }
      ]
    },
    "homebound": {
      "flights": [
        {
          "flight_number": "string",
          "origin": "string",
          "destination": "string",
          "departure": "2019-08-24T14:15:22Z",
          "arrival": "2019-08-24T14:15:22Z"
        }
      ]
    },
    "number_of_passengers": 1
  },
  "contact": {
    "email": "user@example.com",
    "phone": "string",
    "first_name": "string",
    "last_name": "string"
  },
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z"
}
{
  "errors": [
    {
      "status_text": "Incomplete",
      "error_code": "string",
      "response_code": 0,
      "description": "string",
      "recoverable": true
    }
  ]
}
{
  "errors": [
    {
      "status_text": "Incomplete",
      "error_code": "string",
      "response_code": 0,
      "description": "string",
      "recoverable": true
    }
  ]
}
{
  "errors": [
    {
      "status_text": "Incomplete",
      "error_code": "string",
      "response_code": 0,
      "description": "string",
      "recoverable": true
    }
  ]
}
{
  "errors": [
    {
      "status_text": "Incomplete",
      "error_code": "string",
      "response_code": 0,
      "description": "string",
      "recoverable": true
    }
  ]
}