Skip to content

Add order item

Add new order item to the order is possible using add order item endpoint.

POST https://api.discover.swiss/test/market/v1/orders/{orderNumber}/items

There is 2 ways to add new orderItem:

  • using product configurations
  • using offerBundle

Add OrderItem with product configurations

It is possible to provide an orderItem with the product configuration in the request.

It is advised to do so if:

  • offerBundles are not availabe for all products
  • Adding new order without searching for offerBundle.
{
    "orderQuantity": 1,
    "orderedItem": {
        "product": {
            "identifier": "nova_zurichcard24"
        },
        "validFrom": "2021-10-22T10:00:00",
        "traveler": [
            {
                "id":"helma_lovers",
                "salutation":"Fr",
                "givenName": "Helma",
                "familyName": "Lovers",
                "birthDate": "2000-02-18T15:00:00",
                "Salutation": "Mrs",
                "Nationality": "CH",
                "Passport": "N123123"
            },
            {
                "id":"huan_lovers",
                "salutation":"child",
                "givenName": "Huan",
                "familyName": "Lovers",
                "birthDate": "2010-02-18T15:00:00"
            }
        ]
    }
}
POST https://api.discover.swiss/test/market/v1/orders/{orderId}/items
{
    "orderItem": {
        "orderItemNumber": "21-102000-1",
        "orderItemStatus": "Placed",
        "orderQuantity": 1,
        "orderedItem": {
            "product": {
                "identifier": "nova_zurichcard24",
                "productIdentifier": "nova_zurichcard",
                "sku": "895",
                "name": "ZVV Zürich Card, ZVV Zürich Card 24 hours",
                "dataGovernance": {
                    "provider": {
                        "acronym": "sbb"
                    },
                    "term": {
                        "code": "ZHT-AGB|ZHT-DPP"
                    },
                    "source": {}
                },
                "priceList": [
                    {
                        "priceCHF": 19.0,
                        "maxAllowedAge": 15,
                        "minAllowedAge": 5
                    },
                    {
                        "priceCHF": 27.0,
                        "maxAllowedAge": 2500,
                        "minAllowedAge": 15
                    }
                ],
                "taxRate": 0.077
            },
            "validFrom": "2021-10-22T10:00:00-06:00",
            "traveler": [
                {
                    "priceCHF": 27.0,
                    "identifier": "d1a32fc6-88b5-df51-0258-91d46b6148a3",
                    "salutation": "Mrs",
                    "givenName": "Helma",
                    "familyName": "Lovers",
                    "birthDate": "2000-02-18T00:00:00",
                    "nationality": "CH",
                    "passport": "no passport"
                },
                {
                    "priceCHF": 19.0,
                    "identifier": "d9b703f2-6043-d06a-3fcf-430e756c8309",
                    "salutation": "Child",
                    "givenName": "Huan",
                    "familyName": "Lovers",
                    "birthDate": "2010-02-18T00:00:00"
                }
            ]
        },
        "orderDelivery": "e-ticket",
        "amount": 46.0,
        "amountCHF": 46.0,
        "taxRate": 3.542,
        "taxCHF": 3.542,
        "ticket": []
    },
    "validationMessages": []
}

Add OrderItem with offer bundle

If an offer bundle was found before then it is possible to add a new order item using found offer bundle. For this, it is necessary to provide offerBundleId.

Information

OfferBundleId can be absent in case product doesn't support offers. In that case offerBundleId is not needed

{
    "orderQuantity": 1,
    "offerBundleId":"c2f03f0f-e206-42d4-ac87-4406f9e746ae"
}
POST https://api.discover.swiss/test/market/v1/orders/21-102000/items
{
    "orderItem": {
        "orderItemNumber": "21-102000-4",
        "orderItemStatus": "Checkout",
        "orderQuantity": 1,
        "orderedItem": {
            "product": {
                "identifier": "nova_zurichcard72",
                "productIdentifier": "nova_zurichcard",
                "sku": "898",
                "name": "ZVV Zürich Card, ZVV Zürich Card 72 hours",
                "dataGovernance": {
                    "provider": {
                        "acronym": "sbb"
                    },
                    "term": {
                        "code": "ZHT-AGB|ZHT-DPP"
                    },
                    "source": {
                        "acronym": "ZHT"
                    }
                },
                "priceList": [
                    {
                        "priceCHF": 37.0,
                        "maxAllowedAge": 15,
                        "minAllowedAge": 5
                    },
                    {
                        "priceCHF": 53.0,
                        "maxAllowedAge": 2500,
                        "minAllowedAge": 15
                    }
                ],
                "taxRate": 0.077
            },
            "validFrom": "2021-10-15T00:00:00-06:00",
            "traveler": [
                {
                    "priceCHF": 53.0,
                    "identifier": "jhon",
                    "givenName": "Jhon",
                    "familyName": "Smith",
                    "birthDate": "1980-02-18T00:00:00"
                },
                {
                    "priceCHF": 53.0,
                    "identifier": "jessika",
                    "givenName": "Jessika",
                    "familyName": "Smith",
                    "birthDate": "1979-02-18T00:00:00"
                }
            ]
        },
        "orderDelivery": "e-ticket",
        "amount": 106.0,
        "amountCHF": 106.0,
        "taxRate": 8.161999999999999,
        "taxCHF": 8.161999999999999,
        "ticket": [],
        "offerBundleId": "c2f03f0f-e206-42d4-ac87-4406f9e746ae"
    },
    "validationMessages": []
}

Add OdredItem with offer bundle and update travelers

During the searching of offerBundle it is not necessary to provide all of the travelers properties.

During the creation of the order item with offer bundle which do not provide all required for order travelers fields then validation errors will be returned.
To resolve those validation error is necessary to call add order item with selected offerBundleId and fulfilled travelers (it is necessary to use same travelers identifiers).

Information

Required travelers fields for zurich card offerBundle are: birthDate
Required travelers fields for order with zurich card are: birthDate, givenName, familyName

Warning

It is not allowed to update required fields and travelers identifier in the offerBundle. Any attempts will be ignored.

{
    "product": {
        "identifier": "nova_zurichcard72"
    },
    "validFrom": "2021-10-15T00:00:00",
    "traveler": [
        {
            "identifier": "jhon",
            "birthDate": "1980-02-18"

        },
        {
            "identifier": "jessika",
            "birthDate": "1979-02-18T15:00:00"

        }
    ]
}
POST https://api.discover.swiss/test/market/v1/orders/21-102000/offers
{
    "validationMessages": [],
    "offerBundle": [
        {
            "id": "d5e3e390-858f-44d2-8cdd-c19698bc62a9",
            "totalPrice": 10600,
            "currency": "CHF",
            "expiresAt": "2021-10-10T09:57:43-06:00",
            "offer": [
                {
                    "id": "d97f169f-6bcb-43a4-b646-d186a60abc0a",
                    "expiresAt": "2021-10-10T09:57:43-06:00",
                    "title": "ZVV Zürich Card 72 hours",
                    "description": ".\tA ticket for visitors and guests who would like to combine their stay with a visit to a museum or an excursion to the local recreation area, also valid for travel between the airport and the city.\n\n.\tZones 110 111 121 140 150 154 155.\n\n.\tPeriod of validity: 72 hours.\n\n.\tAvailable for 2nd class travel.\n\n.\tReduced fare for children from their 6th to their 16th birthday.\n\n.\twww.zuerichcard.com",
                    "travelerId": "jessika",
                    "price": 5300,
                    "currency": "CHF"
                },
                {
                    "id": "eb4efdc1-9ae1-42ea-ad7a-4e591328d702",
                    "expiresAt": "2021-10-10T09:57:43-06:00",
                    "title": "ZVV Zürich Card 72 hours",
                    "description": ".\tA ticket for visitors and guests who would like to combine their stay with a visit to a museum or an excursion to the local recreation area, also valid for travel between the airport and the city.\n\n.\tZones 110 111 121 140 150 154 155.\n\n.\tPeriod of validity: 72 hours.\n\n.\tAvailable for 2nd class travel.\n\n.\tReduced fare for children from their 6th to their 16th birthday.\n\n.\twww.zuerichcard.com",
                    "travelerId": "jhon",
                    "price": 5300,
                    "currency": "CHF"
                }
            ]
        }
    ]
}
{
    "orderQuantity": 1,
    "offerBundleId":"d5e3e390-858f-44d2-8cdd-c19698bc62a9",
    "orderedItem": {
        "traveler": [
            {
                "identifier": "jessika",
                "birthDate": "1979-02-18T15:00:00",
                "salutation":"Fr",
                "familyName": "Jessika",
                "givenName": "Smith"
            },
            {
                "identifier": "jhon",
                "birthDate": "1980-02-18",
                "familyName": "Jhon",
                "givenName": "Smith"
            }
        ]
    }
}
POST https://api.discover.swiss/test/market/v1/orders/{orderId}/items
{
    "orderItem": {
        "orderItemNumber": "21-102000-2",
        "orderItemStatus": "Placed",
        "orderQuantity": 1,
        "orderedItem": {
            "product": {
                "identifier": "nova_zurichcard72",
                "productIdentifier": "nova_zurichcard",
                "sku": "898",
                "name": "ZVV Zürich Card, ZVV Zürich Card 72 hours",
                "dataGovernance": {
                    "provider": {
                        "acronym": "sbb"
                    },
                    "term": {
                        "code": "ZHT-AGB|ZHT-DPP"
                    },
                    "source": {
                        "acronym": "ZHT"
                    }
                },
                "priceList": [
                    {
                        "priceCHF": 37.0,
                        "maxAllowedAge": 15,
                        "minAllowedAge": 5
                    },
                    {
                        "priceCHF": 53.0,
                        "maxAllowedAge": 2500,
                        "minAllowedAge": 15
                    }
                ],
                "taxRate": 0.077
            },
            "validFrom": "2021-10-15T00:00:00-06:00",
            "traveler": [
                {
                    "priceCHF": 53.0,
                    "identifier": "jhon",
                    "givenName": "Smith",
                    "familyName": "Jhon",
                    "birthDate": "1980-02-18T00:00:00"
                },
                {
                    "priceCHF": 53.0,
                    "identifier": "jessika",
                    "salutation": "Mrs",
                    "givenName": "Smith",
                    "familyName": "Jessika",
                    "birthDate": "1979-02-18T00:00:00"
                }
            ]
        },
        "orderDelivery": "e-ticket",
        "amount": 106.0,
        "amountCHF": 106.0,
        "taxRate": 8.161999999999999,
        "taxCHF": 8.161999999999999,
        "ticket": [],
        "offerBundleId": "d5e3e390-858f-44d2-8cdd-c19698bc62a9"
    },
    "validationMessages": []
}

Last update: December 2, 2021 16:32:19