Create order
The only way to create an order is to use place order endpoint.
These are possible statuses for the new created order:
- Status = New does not make any update and some data validation.
- Status = Checkout validates the order and do order update (set order item numbers, getting product information from infocenter and apply offers if it's needed)
- Status = Placed validates the order, gets offers if it is needed, and if possible move it to the placed status and the order is ready to get paid
The response contains the updated order object (product information, prices) and the validation errors if there are any.
Place empty order¶
Sometimes it is needed to create empty order and then add order items to it.
{ }
POST https://api.discover.swiss/test/b2bmarket/v1/orders
{
"order": {
"orderNumber": "21-102000",
"orderDate": "2021-10-11T07:20:54.180294-06:00",
"customer": {
"profileId": "a23a4be8-8f4f-4a53-ae29-917349c11df4",
"additionalName": "Remark",
"address": {
"addressCountry": "CH",
"addressLocality": "Werdenberg",
"addressRegion": "SG",
"postalCode": "9472",
"streetAddress": "Dorf 1"
},
"email": "harry.phoenix@test.in",
"familyName": "Phoenix",
"gender": "Male",
"givenName": "Harry",
"nationality": "CH",
"birthDate": "2000-12-07",
"displayName": "Harry Phoenix",
"isGuest": "True",
"passport": "ccxxx",
"maritalStatus": "Single",
"mobilePhone": "079 365 45 88",
"salutation": "Mr",
"preferredLanguage": "de",
"hasProfileImage": false,
"dataGovernance": {
"origin": [
{
"datasource": "some_datasource",
"created": "2021-09-27T06:15:00.6913204-06:00",
"lastModified": "2021-10-10T02:43:41.8015455-06:00",
"provider": {
"acronym": "some_acronym"
},
"source": {
"acronym": "some_acronym"
},
"author": {
"identifier": "a23a4be8-8f4f-4a53-ae29-917349c11df4"
}
}
]
},
"createdDateTime": "2021-09-27T06:15:00.6924683-06:00",
"lastModified": "2021-10-10T02:43:41.8021602-06:00",
"lastModifiedBy": "a23a4be8-8f4f-4a53-ae29-917349c11df4",
"createdBySubscription": "some_subscription",
"lastModifiedBySubscription": "some_subscription"
},
"orderStatus": "New",
"priceCurrency": "CHF",
"orderedItem": [],
"term": [],
"partnerAcronym": "ds",
"profileId": "a23a4be8-8f4f-4a53-ae29-917349c11df4",
"@id": "https://api.discover.swiss/test/b2bmarket/v1/orders/21-102000",
"dataGovernance": {
"origin": [
{
"datasource": "some_datasource",
"created": "2021-09-27T06:15:00.6913204-06:00",
"lastModified": "2021-10-10T02:43:41.8015455-06:00",
"provider": {
"acronym": "some_acronym"
},
"source": {
"acronym": "some_acronym"
},
"author": {
"identifier": "a23a4be8-8f4f-4a53-ae29-917349c11df4"
}
}
]
},
"createdDateTime": "2021-10-11T07:20:54.5296789-06:00",
"lastModified": "2021-10-11T07:20:54.5296712-06:00",
"lastModifiedBy": "a23a4be8-8f4f-4a53-ae29-917349c11df4",
"createdBySubscription": "some_subscription",
"lastModifiedBySubscription": "some_subscription"
},
"validationMessages": []
}
Place order with product configurations¶
To create an order with an orderItem using product configuration it is necessary to declare product configuration for each orderItem.
{
"orderStatus": "Placed",
"priceCurrency": "CHF",
"orderedItem": [
{
"orderQuantity": 1,
"orderedItem": {
"product": {
"identifier": "nova_zurichcard24"
},
"traveler": [
{
"givenName": "Alex",
"familyName": "Alex",
"birthDate": "2014-09-14"
}
],
"validFrom": "2021-10-19"
}
}
]
}
POST https://api.discover.swiss/test/b2bmarket/v1/orders
{
"order": {
"orderNumber": "21-102000",
"orderDate": "2021-10-11T13:49:21.7692814+00:00",
"customer": {
"profileId": "a23a4be8-8f4f-4a53-ae29-917349c11df4",
"additionalName": "Remark",
"address": {
"addressCountry": "CH",
"addressLocality": "Werdenberg",
"addressRegion": "SG",
"postalCode": "9472",
"streetAddress": "Dorf 1"
},
"email": "harry.phoenix@test.in",
"familyName": "Phoenix",
"gender": "Male",
"givenName": "Harry",
"nationality": "CH",
"birthDate": "2000-12-07",
"displayName": "Harry Phoenix",
"isGuest": "True",
"passport": "ccxxx",
"maritalStatus": "Single",
"mobilePhone": "079 365 45 88",
"salutation": "Mr",
"preferredLanguage": "de",
"hasProfileImage": false,
"dataGovernance": {
"origin": [
{
"datasource": "some_datasource",
"created": "2021-09-27T06:15:00.6913204-06:00",
"lastModified": "2021-10-10T02:43:41.8015455-06:00",
"provider": {
"acronym": "some_acronym"
},
"source": {
"acronym": "some_acronym"
},
"author": {
"identifier": "a23a4be8-8f4f-4a53-ae29-917349c11df4"
}
}
]
},
"createdDateTime": "2021-09-27T06:15:00.6924683-06:00",
"lastModified": "2021-10-10T02:43:41.8021602-06:00",
"lastModifiedBy": "a23a4be8-8f4f-4a53-ae29-917349c11df4",
"createdBySubscription": "some_subscription",
"lastModifiedBySubscription": "some_subscription"
},
"orderStatus": "Placed",
"priceCurrency": "CHF",
"totalAmount": 19.0,
"totalAmountCHF": 19.0,
"totalTaxCHF": 1.463,
"language": "en",
"orderedItem": [
{
"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-19T00:00:00+00:00",
"traveler": [
{
"priceCHF": 19.0,
"identifier": "f6b7264c-70ca-522f-5bfc-d8382e2443f8",
"givenName": "Alex",
"familyName": "Alex",
"birthDate": "2014-09-14T00:00:00"
}
]
},
"orderDelivery": "e-ticket",
"amount": 19.0,
"amountCHF": 19.0,
"taxRate": 1.463,
"taxCHF": 1.463,
"ticket": [],
"offerBundleId": "d4702201-bac1-4f54-989d-a32ddfb70250"
}
],
"term": [
{
"termCode": "ZHT-AGB|ZHT-DPP",
"accepted": false,
"acceptedDate": "2021-10-11T13:49:26.4425621+00:00",
"termVersions": [
{
"@id": "{{ infoUrl }}/termversions/ZHT-AGB-2.0",
"code": "ZHT-AGB-2.0",
"name": "Allgemeine Geschäftsbedingungen von Zürich Tourismus",
"partnerName": "Zurich Tourism",
"termDocument": "https://www.zuerich.com/gtc",
"validFrom": "2018-08-29T00:00:00+00:00",
"termCode": "ZHT-AGB"
},
{
"@id": "{{ infoUrl }}/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-28T00:00:00+00:00",
"termCode": "ZHT-DPP"
}
]
}
],
"partnerAcronym": "ds",
"profileId": "a23a4be8-8f4f-4a53-ae29-917349c11df4",
"@id": "https://api.discover.swiss/test/b2bmarket/v1/api/orders/21-102000",
"dataGovernance": {
"origin": [
{
"datasource": "some_datasource",
"created": "2021-09-27T06:15:00.6913204-06:00",
"lastModified": "2021-10-10T02:43:41.8015455-06:00",
"provider": {
"acronym": "some_acronym"
},
"source": {
"acronym": "some_acronym"
},
"author": {
"identifier": "a23a4be8-8f4f-4a53-ae29-917349c11df4"
}
}
]
},
"createdDateTime": "2021-10-11T13:49:21.6640121+00:00",
"lastModified": "2021-10-11T13:49:31.2156037+00:00",
"lastModifiedBy": "a23a4be8-8f4f-4a53-ae29-917349c11df4",
"createdBySubscription": "some_subscription",
"lastModifiedBySubscription": "some_subscription"
},
"validationMessages": []
}