Order webhook

Behaviour

In S-360 an order represents a transaction between a contact and the institution operating S-360. It can be a sale, a refund, a reservation, an option...

With this webhook activated, each time a order is finalized (closed or abandonned), S-360 backend calls a given url transmitting the order in the form of a JSON payload.

The strucure of the payload is defined in the following API getOrderDetails.

This behavior is asynchronous: the list of closed/abandonned order ids is stored in a queue, and this queue is processed every M minutes, with M between 1 and 1440.


Synchronization rate

When setting up the webhook, the operator defines:

  • the frequency M: the queue of pending changes will be processed every M minutes.
  • the batch size S: during each process, S orders will be processed.
  • the bucket size bs: a payload POST-ed to the remote URL will consist of a maximum of bs orders.

Default values:

  • M=15 minutes
  • S=100
  • bs=1

URL and HTTP method

The callee must provide an URL which will accept POST requests containg the JSON payload described below and return 200 when accepted.

If the URL returns values (an id, a message...), those values will be ignored.

If the URL returns an error, the same order will be sent every M minute, 12 times. After all those tentatives, the synchro will be abandonned, but the failed contacts will be logged.

Authentication

It is possible for S-360 to process an authentication on the remote URL. Here are the supported authentication protocols:

Modifying the content of the payload

Details

It is possible to select which order elements will be sent, with the following possible options.

  • ORDER: Information related to order selected.
  • OPERATION: content of the order: products, tariffs, quantities, advantages used... (includes the preceeding)
  • MOVEMENT: individual details for each operation: seat, ticket owner... (includes the preceeding)
  • TICKET: tickets related to the movements. (includes the preceeding)
  • TICKET_OR_OPERATION: tickets and orders related to the movements. (includes the preceeding). If more than 200, it will refer to operation, if less, ticket.
  • PAYMENT: For a given order, see: https://mosa.demo-ws.secutix.com/tnseb/apidocs/ExternalPaymentService_latest.html#getPaymentDetails
  • SHIPMENT: For a given shipment, see: https://mosa.demo-ws.secutix.com/tnpsb/apidocs/ShipmentPublicService_latest.html#getShipmentsForOrder

Other modifications

Other modifications, like changing the structure of the payload, keeping only certain fields, etc., is impossible. If you need a specific payload, you likely want a data export webhook.

Filter

A filter can be defined in the interface parameters to control the transmission of only the desired orders. This filter parameter contains a string, based on OrderDetailResult, like this below:

OrderDetailsData.OperationDatas(*).ProductCode=XXXX (if product code of any operation is XXXX)

OrderDetailsData.OperationDatas(ProductCode=XXXX).BasePrice=10000;OrderDetailsData.OrderType=SALE (if base price of the operation with product code XXXX is 10000 and the order type is SALE)

The delimiter of each condition in the filter is the character ";".

When a filter is added to the interface parameters, it's important to set the "Granularity" parameter (possible values in getOrderDetails method).

Setup in backend

  1. Ask for a proxy opening for the destination URL.
  2. In organization/tools/external interfaces create a new interface of type Firehose order
  3. Paste the url in the Url field
  4. Choose the authentication mode : NONE, BASIC_AUTH, API_KEY
    1. NONE : nothing else to do
    2. BASIC_AUTH : put the login in the login field, the password in the password field
    3. API_KEY : put the name of the header in the login field, the key in the password field
  5. Enter the desired granularity of the output result to be synced. By default: "TICKET"
  6. Save
  7. In the schedule menu, create a new schedule with a frequency fitting your needs and batch size of 60 (recommanded default value).

Order JSON example

In case of a bucket size greater than one, the payload will always be a list (surrounded with []), even if the payload only contains one element.

{
    "orderDetailsData": {
        "orderId": 10000418846,
        "orderState": "OPEN",
        "creationDateTime": "2024-05-27T10:45:49.201+02:00",
        "referenceDate": "2024-05-27T02:00:00.000+02:00",
        "expirationDate": "2024-05-27T11:00:49.779+02:00",
        "saleAmount": 0,
        "preSaleAmount": 14000,
        "reservationAmount": 0,
        "optionAmount": 0,
        "waitingAccountBalanceAmount": 0,
        "operationDatas": [
            {
                "operationId": 10229212866133,
                "kind": "SIMPLE_PRODUCT",
                "type": "PRE_SALE",
                "quantity": 1,
                "basePrice": 14000,
                "unitPrice": 14000,
                "withoutVatTotalAmount": 14000,
                "totalAmount": 14000,
                "productId": 101049282449,
                "product": "Billet Musée",
                "productCode": "MSTIC",
                "itemId": 101049310928,
                "siteId": 466636059,
                "site": "MoSA Musée",
                "siteAddress": {
                    "firstAddressLine": "62, rue de Lille",
                    "zipCode": "75007",
                    "locality": "Paris",
                    "countryCode": "FR"
                },
                "contingentId": 466646159,
                "contingent": "Ventes en ligne",
                "numbered": false,
                "audienceSubCategoryId": 306159078,
                "audienceSubCategory": "Adulte",
                "audienceSubCategoryRank": 1,
                "audienceSubCategoryRequireAttachment": false,
                "audienceSubCategoryExternalDescription": "Plein Tarif",
                "vatRate": 0,
                "vatCountryCode": "FR",
                "selfPaidVat": false,
                "operationNumber": 1,
                "productFamilyType": "PASS",
                "productFamilySubType": "VISIT_PASS",
                "itemDisplayExternalDesignation": "Billet Musée",
                "locations": [
                    {
                        "spaceCode": "INTEGR",
                        "siteCode": "MOSA",
                        "spaceExternalName": {
                            "translations": [
                                {
                                    "locale": "fr",
                                    "value": "Tour Intégrée"
                                },
                                {
                                    "locale": "en",
                                    "value": "Integrated Tour"
                                },
                                {
                                    "locale": "es",
                                    "value": "Tour Integrado"
                                },
                                {
                                    "locale": "de",
                                    "value": "Integrierte Tour"
                                },
                                {
                                    "locale": "it",
                                    "value": "Visita Integrato"
                                }
                            ]
                        },
                        "siteExternalName": {
                            "translations": [
                                {
                                    "locale": "fr",
                                    "value": "MoSA Musée"
                                },
                                {
                                    "locale": "en",
                                    "value": "MoSA Museum"
                                },
                                {
                                    "locale": "es",
                                    "value": "Museo MoSA"
                                },
                                {
                                    "locale": "de",
                                    "value": "MWK-Museum"
                                },
                                {
                                    "locale": "it",
                                    "value": "Museo MoSA"
                                }
                            ]
                        },
                        "siteAddress": {
                            "firstAddressLine": "62, rue de Lille",
                            "zipCode": "75007",
                            "locality": "Paris",
                            "countryCode": "FR"
                        }
                    }
                ],
                "fileId": 13116,
                "waitingAccountBalance": 0,
                "season": "Saison 1",
                "crossSellParentOperationIds": [],
                "comfortVariableValues": {},
                "includedInShipmentFee": false,
                "audienceCatId": 15655,
                "exchangeable": true,
                "catalogCurrency": {
                    "currencyCode": "EUR",
                    "symbol": "€",
                    "fractionDigit": 2,
                    "minAmount": 10
                },
                "itemDate": "2024-06-10T11:00:00.000+02:00",
                "timeslotId": 101047469409,
                "timeslotDuration": 7200,
                "championshipSeasonticket": false,
                "allSeasonTicketLinesCompetition": false,
                "visitGroupData": {
                    "visitGroupId": 10229212871158,
                    "numberOfAccompaniers": 0,
                    "numberOfParticipants": 1,
                    "fileRemarks": [],
                    "pricingType": "PER_PERSON",
                    "ticketType": "INDIVIDUAL_TICKET",
                    "groupCriterionElements": [],
                    "guided": false
                },
                "insuredOperationIds": [],
                "isNominative": false
            }
        ],
        "movementDatas": [
            {
                "movementId": 10229212866234,
                "operationId": 10229212866133,
                "type": "SIMPLE_PRODUCT",
                "contingentId": 466646159,
                "contingent": "Ventes en ligne",
                "contactReference": "5442",
                "instanceNumber": 4273,
                "resumed": false,
                "attributionMatch": "NO_EXPECTATION",
                "transferable": false
            }
        ],
        "movementTicketDatas": [],
        "contactReference": "5442",
        "salesChannelName": {
            "translations": [
                {
                    "locale": "fr",
                    "value": "Vente en ligne"
                },
                {
                    "locale": "en",
                    "value": "Ticketshop"
                },
                {
                    "locale": "es",
                    "value": "Ticketshop"
                },
                {
                    "locale": "de",
                    "value": "Ticketshop"
                },
                {
                    "locale": "it",
                    "value": "Ticketshop"
                }
            ]
        },
        "orderType": "SALE",
        "generatedContiguities": [],
        "orderOriginData": {
            "toCreateToken": false
        },
        "salesChannelType": "INTERNET_B2C",
        "orderInstallmentsToCreate": [],
        "orderSecretId": "33e1993b-7e31-4c44-8b8b-2ac646d258a0_10000418846",
        "orderOriginator": "TICKETSHOP",
        "salesChannelCode": "B2C",
        "catalogCurrency": {
            "currencyCode": "EUR",
            "symbol": "€",
            "fractionDigit": 2,
            "minAmount": 10
        },
        "organizationCode": "MOSA",
        "organizationName": {
            "translations": [
                {
                    "locale": "fr",
                    "value": "Musée des Sciences et des Arts"
                },
                {
                    "locale": "en",
                    "value": "Museum of Science and Art"
                },
                {
                    "locale": "es",
                    "value": "Museo de Ciencia y Arte"
                },
                {
                    "locale": "de",
                    "value": "Museum für Wissenschaft und Kunst"
                },
                {
                    "locale": "it",
                    "value": "Museo delle Scienze e delle Arti"
                }
            ]
        },
        "multicurrency": false
    },
    "orderDetailGranularity": "TICKET"
}