Skip to content

Cancel order

With the cancel endpoint you can attempt to cancel any order in state Fulfilled or Delivered.
There are options to cancel single tickets, complete orderItems or the full order.

However, it is not alway possible to cancel all tickets. Reasons are - the supplier does not support the cancel tickets by api - the terms of cancellations are not valid (for example valid-from date in the past)

We cancel what is possible and the rest remains untouched.
That means you can end up with a partially canceled order: - Order-state is state is still Fulfilled - OrderItem-state is PartiallyCanceled - Tickets are inactive (isActive = false)

Warning

Canceled tickets are not available in the ticket endpoints anymore.
They are still in the order (api, order download, order in profile notification) and are delivered in the Profile notifications with the property isActive set to false

refer to Order workflow for detailed state information.

Cancel an order

The body is optional in the request and all parameters in it as well.
The request returns regular order response containing the updated order and validation messages.

{
    "emailTo": "test@discover.swiss",
    "attachInvoice": true,
    "orderItemNumbers": [
        "25-204909-1"
    ],
    "ticketIds": [
        "sbb_42668367884"
    ]
}
POST {{ marketB2BUrl }}/orders/25-204909/cancel
{
    "validationMessages": [],
    "order": {
        "orderNumber": "25-204909",
        "orderStatus": "Canceled",
        "partnerAcronym": "ds",
        "orderDate": "2025-09-25T06:32:02.4023071+02:00",
        "customer": {
            "address": {},
            "email": "test@discover.swiss",
            "familyName": "Dou",
            "givenName": "Joe",
            "isGuest": "True",
            "createdDateTime": "2025-09-25T06:32:03.0985888+02:00",
            "lastModified": "2025-09-25T06:32:03.0985889+02:00"
        },
        "customerField": [
            {
                "propertyId": "address.addressCountry",
                "type": "text",
                "name": "Country",
                "required": false,
                "requiredForOffers": false,
                "possibleValue": {}
            }
        ],
        "priceCurrency": "CHF",
        "salesChannel": "B2B",
        "totalAmount": 0.0,
        "totalAmountCHF": 0.0,
        "totalTax": 0.0,
        "totalTaxCHF": 0.0,
        "mailBodyToken": "https://tickets-test.discover.swiss/mailbodies/25-204909_a4383f65-07b5-44f2-a0bc-1ac2cddf3dd5.html",
        "orderTokenName": "T-G2K55DD5",
        "language": "en",
        "orderedItem": [
            {
                "orderItemNumber": "25-204909-1",
                "orderItemStatus": "Canceled",
                "orderQuantity": 1,
                "orderedItem": {
                    "product": {
                        "identifier": "nova_zurichcard24",
                        "productIdentifier": "nova_zurichcard"
                    },
                    "validFrom": "2025-09-26T06:32:02.3136652+02:00",
                    "numberOfTravelers": 1,
                    "traveler": [
                        {
                            "price": 29.0,
                            "priceCHF": 29.0,
                            "currency": "CHF",
                            "priceCategory": "Adult",
                            "priceCategoryName": "Adult",
                            "displayPosition": 100,
                            "identifier": "787011d6-8747-5aca-ca33-0dfa14d36c57",
                            "givenName": "Mykola",
                            "familyName": "Mclaud",
                            "birthDate": "1977-02-18T00:00:00",
                            "readonly": false
                        }
                    ],
                    "vehicle": []
                },
                "orderDelivery": "e-ticket",
                "orderItemDelivery": {
                    "mode": "digital",
                    "method": "e-ticket",
                    "name": "e-ticket"
                },
                "amount": 0.0,
                "amountCHF": 0.0,
                "tax": 0.0,
                "taxCHF": 0.0,
                "currency": "CHF",
                "hideAmount": false,
                "ticket": [
                    {
                        "name": "Zürich Card, 24 hours",
                        "product": {
                            "identifier": "nova_zurichcard24"
                        },
                        "additionalType": "PublicTransportation",
                        "ticketNumber": "0507094680",
                        "bookingNumber": "38835772617",
                        "ticketToken": "https://tickets-test.discover.swiss/tickets/60873552-2aaf-413e-acc8-a6c049fdb630_nr_704974837381.pdf",
                        "dateIssued": "2025-09-25T06:32:04.9767929+02:00",
                        "issuedBy": {
                            "acronym": "sbb"
                        },
                        "priceCurrency": "CHF",
                        "priceCategory": "Adult",
                        "priceCategoryName": "Adult",
                        "totalPrice": 29.0,
                        "hideAmount": false,
                        "underName": {
                            "identifier": "787011d6-8747-5aca-ca33-0dfa14d36c57",
                            "givenName": "Mykola",
                            "familyName": "Mclaud",
                            "birthDate": "1977-02-18T00:00:00",
                            "readonly": false
                        },
                        "underNames": [
                            {
                                "identifier": "787011d6-8747-5aca-ca33-0dfa14d36c57",
                                "givenName": "Mykola",
                                "familyName": "Mclaud",
                                "birthDate": "1977-02-18T00:00:00",
                                "readonly": false
                            }
                        ],
                        "vehicle": [],
                        "validFrom": "2025-09-26T06:32:00+02:00",
                        "validUntil": "2025-09-27T06:32:00+02:00",
                        "ticketTokenId": "704974837381",
                        "qrCodeToken": "https://tickets-test.discover.swiss/qrcodes/d0c04f92-f5b2-49b0-a685-ec0e48a28103_nr_704974837381.png",
                        "htmlToken": "https://tickets-test.discover.swiss/htmls/dbedcbe4-d4f6-4209-b05c-323c70ca909b_nr_704974837381.html",
                        "numberOfTravelers": 1,
                        "isActive": false,
                        "@id": "https://api.discover.swiss/test/profile/tickets/sbb_42668367884",
                        "identifier": "sbb_42668367884"
                    },
                    {
                        "parentTicketIdentifier": "sbb_42668367884",
                        "name": "Zürich Card, 24 hours Ticket Gateway",
                        "product": {
                            "identifier": "nova_zurichcard24"
                        },
                        "additionalType": "ETicket",
                        "dateIssued": "2025-09-25T06:32:05.5951072+02:00",
                        "issuedBy": {
                            "acronym": "pts"
                        },
                        "priceCurrency": "CHF",
                        "totalPrice": 0.0,
                        "hideAmount": false,
                        "underNames": [
                            {
                                "identifier": "787011d6-8747-5aca-ca33-0dfa14d36c57",
                                "givenName": "Mykola",
                                "familyName": "Mclaud",
                                "birthDate": "1977-02-18T00:00:00",
                                "readonly": false
                            }
                        ],
                        "vehicle": [],
                        "validFrom": "2025-09-26T06:32:02.3136652+02:00",
                        "validUntil": "2025-09-27T06:32:02.3136652+02:00",
                        "ticketTokenId": "TEONG9n6A898Mj",
                        "qrCodeToken": "https://tickets-test.discover.swiss/qrcodes/29f3976c-a2ae-490e-a3eb-a23cfc57d66d_nr_TEONG9n6A898Mj.png",
                        "numberOfTravelers": 1,
                        "isActive": false,
                        "@id": "https://api.discover.swiss/test/profile/tickets/pts_TEONG9n6A898Mj",
                        "identifier": "pts_TEONG9n6A898Mj"
                    }
                ],
                "offerBundleId": "1096392b-de23-4192-a2ae-214db5133c8e",
                "additionalProperty": [],
                "displayPosition": 100
            }
        ],
        "expiresAt": "2025-09-25T06:47:02+02:00",
        "term": [
            {
                "termCode": "ZHT-AGB|ZHT-DPP",
                "origin": "B2bMarketplaceService",
                "accepted": true,
                "acceptedDate": "2025-09-25T06:32:02.5356701+02:00",
                "termVersions": [
                    {
                        "@id": "https://api.discover.swiss/test/info/v2/termversions/ZHT-AGB-2.0",
                        "code": "ZHT-AGB-2.0",
                        "name": "General Terms and Conditions of Zürich Tourism",
                        "partnerName": "Zurich Tourism",
                        "termDocument": "https://www.zuerich.com/en/visit/general-terms-and-conditions",
                        "validFrom": "2018-08-29T02:00:00+02:00",
                        "termCode": "ZHT-AGB"
                    },
                    {
                        "@id": "https://api.discover.swiss/test/info/v2/termversions/ZHT-DPP-2019-10-28",
                        "code": "ZHT-DPP-2019-10-28",
                        "name": "Datenschutzerklärung von Zürich Tourismus",
                        "partnerName": "Zurich Tourism",
                        "termDocument": "https://www.zuerich.com/datenschutz",
                        "validFrom": "2019-10-28T01:00:00+01:00",
                        "termCode": "ZHT-DPP"
                    }
                ]
            }
        ],
        "additionalProperty": [
            {
                "value": "mailbodies/25-204909_a4383f65-07b5-44f2-a0bc-1ac2cddf3dd5.html",
                "propertyId": "generatedMailBodyToken"
            }
        ],
        "orderPaymentStatus": "Refunded",
        "orderPaymentDetails": {
            "id": "205661d9-6ba7-4ff8-9f02-729d75cef585",
            "paymentType": "refund",
            "orderPaymentStatus": "Transferred",
            "paymentProvider": "Manual",
            "amountCurrency": -29.0,
            "currency": "CHF",
            "restrictions": []
        },
        "tax": [
            {
                "taxRate": 0.081,
                "tax": 0.0,
                "taxCHF": 0.0
            }
        ],
        "orderPaymentDetailsList": [
            {
                "id": "19bfa78a-51ce-45af-b471-ddbdbdc0aa64",
                "paymentType": "B2b",
                "reference": "Some reference text",
                "orderPaymentStatus": "Transferred",
                "paymentProvider": "Manual",
                "amountCurrency": 29.0,
                "currency": "CHF",
                "restrictions": []
            },
            {
                "id": "205661d9-6ba7-4ff8-9f02-729d75cef585",
                "paymentType": "refund",
                "orderPaymentStatus": "Transferred",
                "paymentProvider": "Manual",
                "amountCurrency": -29.0,
                "currency": "CHF",
                "restrictions": []
            }
        ],
        "profileId": "b2b-ds",
        "@id": "https://api.discover.swiss/test/b2bmarket/v1/orders/25-204909",
        "dataGovernance": {
            "origin": [
                {
                    "datasource": "ds-systemtest-test",
                    "created": "2025-09-25T04:32:02.3540387+00:00",
                    "lastModified": "2025-09-25T04:32:08.7874063+00:00",
                    "provider": {
                        "acronym": "ds"
                    },
                    "source": {
                        "acronym": "ds"
                    },
                    "author": {
                        "identifier": "b2b-ds"
                    }
                },
                {
                    "datasource": "ds-allapi-test",
                    "created": "2025-09-25T12:15:46.7137941+00:00",
                    "lastModified": "2025-09-25T12:15:47.8872908+00:00",
                    "provider": {
                        "acronym": "ds"
                    },
                    "source": {
                        "acronym": "ds"
                    },
                    "author": {
                        "identifier": "b2b-ds"
                    }
                }
            ]
        },
        "createdDateTime": "2025-09-25T06:32:02.3540407+02:00",
        "lastModified": "2025-09-25T06:32:08.7874071+02:00",
        "createdBySubscription": "ds-systemtest-test",
        "lastModifiedBySubscription": "ds-systemtest-test"
    }
}