Summary

If Webhook API integration is not a solution for you, World’s Marathons enables data transfer to your own registration system by sending a json file with the order data as an attachment to the order confirmation email.

Activate JSON File Attachment

To activate the JSON file attachment navigate into the Notifications menu in the Event Settings menu in the Race Office. From there you’ll be able to activate the file attachment. From here you’ll also be able to get your Secret.

Reading the JSON File

For security reasons the file is encrypted using AES 128 encryption and 16 bytes IV with UT8 encoding. To decrypt it, you need the Secret provided in the Notifications settings. Upon reading the json file you'll get a string looking like this:

ApQR9rsWaaxB+pkYPd47PQ==:VoV1bMoq05st5zUQeIDh+N6nq7fBdNxCzXKkNzTkgJFJrvkX...

Split the string using the char ":" as separator. The first part of the string is the IV you'll need for the decryption, the second part is the JSON object.

Here is some examples for some languages:
C# - https://www.c-sharpcorner.com/article/encryption-and-decryption-using-a-symmetric-key-in-c-sharp/

Java - https://www.novixys.com/blog/java-aes-example/

Python - https://www.novixys.com/blog/using-aes-encryption-decryption-python-pycrypto/

PHP - https://www.phpclasses.org/browse/file/88347.html

NodeJs - https://lollyrock.com/posts/nodejs-encryption/

Code Example in NodeJS

Example JSON File

After decrypting the file you'll get a JSON with the Order data. Here is an example of the data.

 {
    "event_id": "your-event-id",
    "edition_id": "20190020",
    "order_reference": "2019-00000001",
    "order_date": 1558345762,
    "amount": 130.00,
    "currency": "EUR",
    "coupon": {},
    "team_name": "The Avengers",
    "participants": [
      {
        "id": "1",
        "first_name": "Steve",
        "last_name": "Rogers",
        "email": "[email protected]",
        "gender": "M",
        "nationality": "US",
        "birth_date": "1956-02-25",
        "club": "Cap",
        "tickets": [
          {
            "product_id": "SK-20190020-1",
            "product_name": "Half Marathon",
            "product_type": "ticket",
            "vat": 20.0,
            "price": 90.0,
            "product_discount": null,
            "external_product_id": "custom-id-1"
          }
        ],
        "add_ons": [
          {
            "product_id": "SK-20190020-4",
            "product_name": "T-Shirt",
            "product_type": "add-on",
            "vat": 20.0,
            "price": 30.0,
            "product_discount": null,
            "external_product_id": "custom-id-2"
            "options" [
              {
                "label": "Size",
                "value": "XL",
                "external_option_id": "option-id-1",
                "external_value_id": "value-id-1"
              }
            ]
          },
          {
            "product_id": "SK-20190020-8",
            "product_name": "Medal Engraving",
            "product_type": "add-on",
            "vat": 20.0,
            "price": 10.0,
            "product_discount": null,
            "external_product_id": "custom-id-3"
            "options" [
              {
                "label": "Name to be engraved",
                "value": "Captain America",
                "external_option_id": "option-id-2",
                "external_value_id": "value-id-2"
              }
            ]
          }
        ],
        "info": [
          {
            "label": "Is this your first half marathon?",
            "value": "Yes",
            "external_option_id": "option-id-3",
            "external_value_id": "value-id-3"
          }
        ],
        "team_leader": true,
        "address": {
          "address_line_1": "Rd 1",
          "address_line_2": "c/o B",
          "city": "City",
          "state": "State",
          "postal_code": "111 11",
          "country": "US"
        },
        "phone": {
          "code": "+1",
          "phone": "555 01 01 01"
        },
        "ice": {
          "name": "Bruce Banner"
          "code": "+1",
          "phone": "555 01 01 02"
        }
      }
    ]
  }
Did this answer your question?