Requests & Responses

Example payloads for requests to and responses from XCE

Offer Request

The below is an example quote request to send to the XCE widget during initialization.

{
  "schema": "demo-partner-travel:v1",
  "customer": {
    "currency": "EUR",
    "language": "en",
    "country": "NL"
  },
  "context": {
    "departure_country": "GB",
    "destination_country": "GB",
    "reservation_number": "aaca2167-3d55-4d12-a58d-cecf2657a7f4",
    "total_tickets_price": 265,
    "number_of_adults": 1,
    "number_of_children": 0,
    "number_of_infants": 0,
    "trip_start_date": "2025-11-08T09:25:00+11:00",
    "trip_end_date": "2025-11-17T15:45:00+11:00",
    "trips": [
      {
        "legs": [
          {
            "departure_datetime": "2025-11-08T09:25:00+11:00",
            "arrival_datetime": "2025-11-08T11:30:00+11:00",
            "trip_number": "ABC123",
            "departure_location": "Machester Piccadilly",
            "arrival_location": "London Kings Cross",
            "departure_country": "GB",
            "arrival_country": "GB",
            "departure_city": "Machester",
            "arrival_city": "London",
            "transport_mode": "train"
          }
        ]
      },
      {
        "legs": [
          {
            "departure_datetime": "2025-11-08T09:25:00+11:00",
            "arrival_datetime": "2025-11-08T11:30:00+11:00",
            "trip_number": "DEF456",
            "departure_location": "London Kings Cross",
            "arrival_location": "Piccadilly",
            "departure_country": "GB",
            "arrival_country": "GB",
            "departure_city": "London",
            "arrival_city": "Machester",
            "transport_mode": "train"
          }
        ]
      }
    ]
  }
}

Offer Response

The below is an example response provided by XCE during the onSet function once an offer was successfully generated for a customer. This data is required to be stored for later consumption in the confirm offer request.

{
    "id": "fe92ecc3-fe4c-408a-b678-a80e5a073c65",
    "offer_config_id": "409ae590-3302-4d56-9279-af956c1e2170",
    "products": [
        {
            "id": "1846ae80-bda8-4288-aeea-4ad130a4de6a",
            "product_config_id": "6e29bc7e-aca0-48d5-ba65-2c3eeb01ab08",
            "type": "insurance",
            "details": {
                "policy_version_id": "ab150d4d-38bb-4560-9901-fcea7ade5ede",
                "start_date": "2025-11-08T09:25:00+11:00",
                "end_date": "2025-11-22T09:25:00+11:00",
                "finance": {
                    "price": {
                        "total_amount": 18.61,
                        "total_amount_without_tax": null,
                        "total_amount_formatted": "€18.61",
                        "total_amount_without_tax_formatted": null
                    },
                    "tax": {
                        "total_amount": null,
                        "total_amount_formatted": null
                    },
                    "surcharge": {
                        "total_amount": null,
                        "total_amount_formatted": null
                    },
                    "commission": {
                        "total_amount": null,
                        "total_amount_formatted": null
                    }
                },
                "pds_url": "https://staging.xcover.com/en/pds/fe92ecc3-fe4c-408a-b678-a80e5a073c65?policy_type=travel_ticket_cover_v1",
                "files": [],
                "extra_fields": {},
                "experiment": {}
            }
        }
    ],
    "brightwrite_details": {
        "bw_device_id": "de506c6f-d65e-4abd-89f2-9daebb1b721a",
        "bw_experiment_id": null,
        "bw_variant_id": null
    }
}

Last updated