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/b2bmarket/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",
                "givenName": "Helma",
                "familyName": "Lovers",
                "birthDate": "2000-02-18T15:00:00",
                "gender": "Female",
                "Nationality": "CH",
                "Passport": "N123123"
            },
            {
                "id":"huan_lovers",
                "givenName": "Huan",
                "familyName": "Lovers",
                "birthDate": "2010-02-18T15:00:00"
            }
        ]
    }
}
POST https://api.discover.swiss/test/b2bmarket/v1/orders/21-102000/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",
                    "gender": "Female",
                    "givenName": "Helma",
                    "familyName": "Lovers",
                    "birthDate": "2000-02-18T00:00:00",
                    "nationality": "CH",
                    "passport": "no passport"
                },
                {
                    "priceCHF": 19.0,
                    "identifier": "d9b703f2-6043-d06a-3fcf-430e756c8309",
                    "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/b2bmarket/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"
    },
    "dateFrom": "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/b2bmarket/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",
                "gender": "Female"
                "familyName": "Jessika",
                "givenName": "Smith"
            },
            {
                "identifier": "jhon",
                "birthDate": "1980-02-18",
                "familyName": "Jhon",
                "givenName": "Smith"
            }
        ]
    }
}
POST https://api.discover.swiss/test/b2bmarket/v1/orders/21-102000/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",
                    "gender": "Female",
                    "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": []
}

Add OrderItem with addOns

Whenever product has available addons for travelers either orderItem in general it is possible to specify them in the request.

Below is an example of an process of adding order item with item and guest addons

{
    "productVariantIdentifier": "exp_opt_3bd1d5f1-7499-4213-ac77-bb40f85f94db",
    "dateFrom": "2023-05-20T00:00:00Z",
    "dateUntil": "2023-05-22T23:59:59Z",
    "priceCategory": [],
    "numberOfTravelers": 3
}
POST https://api.discover.swiss/test/b2bmarket/v1/orders/21-102000/offers
{
    "validationMessages": [],
    "offerBundle": [
        {
            "id": "32cdc45c-5e24-4f26-acb2-b881ceaa7f2f",
            "productConfiguration": {
                "validFrom": "2023-05-20T07:00:00+00:00",
                "numberOfTravelers": 3
            },
            "totalPrice": 75.0,
            "totalPriceCHF": 75.0,
            "currency": "EUR",
            "expiresAt": "2023-05-08T10:05:33.278965+00:00",
            "offer": [
                {
                    "id": "741ee700-ca59-46d5-ab5b-b2f536e66425",
                    "title": "Adult",
                    "description": "Adult",
                    "priceInformation": "fixed",
                    "price": 25.0,
                    "priceCHF": 25.0,
                    "currency": "EUR"
                },
                {
                    "id": "14c0351c-f193-4db4-ada5-68661d1286a1",
                    "title": "Adult",
                    "description": "Adult",
                    "priceInformation": "fixed",
                    "price": 25.0,
                    "priceCHF": 25.0,
                    "currency": "EUR"
                },
                {
                    "id": "8fb2fc99-3a23-41b7-8287-450459b00d61",
                    "title": "Adult",
                    "description": "Adult",
                    "priceInformation": "fixed",
                    "price": 25.0,
                    "priceCHF": 25.0,
                    "currency": "EUR"
                }
            ],
            "requiresAdditionalConfiguration": true
        }
    ]
}
{
    "orderQuantity":1,
    "offerBundleId": "32cdc45c-5e24-4f26-acb2-b881ceaa7f2f",
    "addOn":[
        {
            "product": {
                "identifier": "49327"
            },
            "orderQuantity": 1
        }
    ],
    "orderedItem": {
        "traveler": [
            {
                "identifier": "uniquieId123",
                "givenName": "Mike",
                "familyName": "Lomerbarth",
                "nationality":"de",
                "gender":"Male",
                "birthDate": "1968-06-26T00:00:00+02:00",
                "addOn":[
                    {
                        "product": {
                            "identifier": "49330"
                        },
                        "orderQuantity": 1
                    }
                ]
            },
            {
            },
            {
            }
        ]
    }
}
POST https://api.discover.swiss/test/b2bmarket/v1/orders/21-102000/items
{
    "orderItem": {
        "orderItemNumber": "21-102000-1",
        "orderItemStatus": "Placed",
        "orderQuantity": 1,
        "orderedItem": {
            "product": {
                "identifier": "exp_opt_3bd1d5f1-7499-4213-ac77-bb40f85f94db",
                "productIdentifier": "exp_act_e1230c72-d332-4992-a760-bd934ea3fad4",
                "sku": "opt_3bd1d5f1-7499-4213-ac77-bb40f85f94db",
                "name": "Ultimate Rockies Adventure, Long Trip",
                "productName": "Ultimate Rockies Adventure",
                "image": {...},
                "option": [],
                "dataGovernance": {...},
                "priceList": [...],
                "taxRate": 0.0,
                "itemField": [...],
                "travelerField": [...],
                "addOnItem": [
                    {
                        "id": "49327",
                        "name": "T-Shirt",
                        "description": "Awesome T-Shirt",
                        "priceList": [
                            {
                                "priceCHF": 27.5,
                                "price": 27.5,
                                "currency": "CHF"
                            }
                        ]
                    }
                ],
                "addOnTraveler": [
                    {
                        "id": "49330",
                        "name": "Photo",
                        "description": "Awesome Photo",
                        "priceList": [
                            {
                                "priceCHF": 11.0,
                                "price": 11.0,
                                "currency": "CHF"
                            }
                        ]
                    }
                ]
            },
            "validFrom": "2023-05-20T07:00:00+00:00",
            "numberOfTravelers": 3,
            "traveler": [
                {
                    "price": 25.0,
                    "priceCHF": 25.0,
                    "currency": "CHF",
                    "priceCategory": "9466800",
                    "priceCategoryName": "Adult",
                    "addOn": [
                        {
                            "product": {
                                "id": "49330",
                                "name": "Photo",
                                "description": "Awesome Photo",
                                "priceList": [
                                    {
                                        "priceCHF": 11.0,
                                        "price": 11.0,
                                        "currency": "CHF"
                                    }
                                ]
                            },
                            "orderQuantity": 1,
                            "amount": 11.0,
                            "amountCHF": 11.0,
                            "taxCHF": 0.0
                        }
                    ],
                    "identifier": "uniquieId123",
                    "salutation": "mr",
                    "givenName": "Mike",
                    "familyName": "Lomerbarth",
                    "birthDate": "1968-06-26T00:00:00",
                    "nationality": "de",
                    "gender": "Male"
                },
                {
                    "price": 25.0,
                    "priceCHF": 25.0,
                    "currency": "CHF",
                    "priceCategory": "9466800",
                    "priceCategoryName": "Adult",
                    "identifier": "7ddebb1f-e049-40ce-9ac0-4f1dbdab996c"
                },
                {
                    "price": 25.0,
                    "priceCHF": 25.0,
                    "currency": "CHF",
                    "priceCategory": "9466800",
                    "priceCategoryName": "Adult",
                    "identifier": "2a5b232c-823f-493b-be55-f3aef278cf32"
                }
            ]
        },
        "orderDelivery": "email",
        "orderItemDelivery": {
            "mode": "digital",
            "method": "email",
            "name": "email"
        },
        "amount": 86.0,
        "amountCHF": 86.0,
        "tax": 0.0,
        "taxCHF": 0.0,
        "currency": "CHF",
        "ticket": [],
        "offerBundleId": "32cdc45c-5e24-4f26-acb2-b881ceaa7f2f",
        "additionalProperty": []
    },
    "validationMessages": []
}