Documentation

Introduction

This documentation will guide you through the process of interacting with the Entradas a tu alcance API. It is divided into two parts:

  • API, backend operations that include:
    • Catalog information
    • Orders information
    • Order confirmation & refund
  • Widget, graphical user interface that manages the order creation.

The whole workflow consists of:

  1. Fetch Catalog.

    Get the event list through the Events catalog endpoint. Here you can find an example response:

    [
      {
        "categoryDescription": "Festival",
        "sessions": [
          {
            "priceFrom": 40,
            "priceTo": 70,
            "id": 940,
            "name": null,
            "dateFrom": "2024-09-06T10:00:00+00:00",
            "dateFromShowTime": true,
            "dateTo": null,
            "dateToShowTime": true,
            "doorsOpenAt": null,
            "timezone": "Europe/Madrid"
          }
        ],
        "place": {
          "id": 1406,
          "name": "Ciudad deportiva Alcoy",
          "address": "Alcoy",
          "zipcode": "03800",
          "city": "Alcoy",
          "province": "Alicante",
          "country": "ES",
          "timezone": "Europe/Madrid"
        },
        "id": 675,
        "name": "Latina Fest 2024",
        "slug": "latina-fest-2024",
        "description": "\u003Cp\u003E\u003Cstrong\u003ELatina Fest 2024\u003C/strong\u003E, el mayor Beach Festival de Europa está de vuelta. Durante los próximos \u003Cstrong\u003E6\u003C/strong\u003E\u003Cstrong\u003E y 7 de septiembre de 2024\u003C/strong\u003E, \u003Cstrong\u003EAlcoy\u003C/strong\u003E será el epicentro del reggaeton, transmitiendo toda la energía y ganas de petarlo una vez más.\u003C/p\u003E\u003Cp\u003E\u003Cstrong\u003EEl mejor reggaeton\u003C/strong\u003E, la mejor compañía y los recintos más espectaculares que puedas imaginar, te están esperando durante el verano de 2024 para que vivas \u003Cstrong\u003Eel verano de tu vida\u003C/strong\u003E.\u003C/p\u003E\u003Cp\u003E\u003Cstrong\u003EARTISTAS CONFIRMADOS: ANUEL AA | SAIKO | TAINY | TIAGO PZK | BRYANT MYERS | MARIA BECERRA | NIO GARCIA | EL ALFA | ALVARO DIAZ\u003C/strong\u003E\u003C/p\u003E\u003Cp\u003ENo puedes pasar por alto la fecha que reunirá a los mayores amantes del reggaeton y \u003Cstrong\u003Eartistas TOP mundiales\u003C/strong\u003E, escogidos especialmente para la ocasión.\u003C/p\u003E\u003Cp\u003E¿Vas a dejar escapar la oportunidad de vivir \u003Cstrong\u003Eel evento más esperado del año\u003C/strong\u003E y de disfrutar de los mejores artistas del mundo?\u003C/p\u003E\u003Cp\u003ENo pierdas la oportunidad de vivir la mejor experiencia del verano y ¡\u003Cstrong\u003Ecompra ya tus entradas\u003C/strong\u003E!\u003C/p\u003E\u003Cp\u003E\u003Cbr /\u003E\u003C/p\u003E\u003Ch4\u003EPOLÍTICA DE MENORES\u003C/h4\u003E\u003Cp\u003EEdad mínima de acceso 16 años.\u003C/p\u003E\u003Cp\u003EMenores con 16 y 17 años con autorización firmada por padre/madre/tutor legal. \u003C/p\u003E\u003Cp\u003E\u003Ca\u003EDescarga aquí tu autorización.\u003C/a\u003E\u003C/p\u003E",
        "descriptionImage": "799afa19-142a-4480-9afb-92b622bfe63e.jpeg",
        "organizer": {
          "id": 1,
          "name": "TECTELTIC ON-LINE SL"
        },
        "logo": "eb569fa8-1cdf-418a-adf7-2111702e7856.jpeg",
        "logoUrl": "https://stgtickets.imgix.net/images/events/eb569fa8-1cdf-418a-adf7-2111702e7856.jpeg",
        "headerImage": "4c1ed0b1-8d58-43f3-9978-44cb9bb5d4ec.jpeg",
        "headerImageUrl": "https://stgtickets.imgix.net/images/events/4c1ed0b1-8d58-43f3-9978-44cb9bb5d4ec.jpeg",
        "widgetImage": "4a7ca56e-881c-4802-b6dd-54d06fb4d1e4.jpeg",
        "widgetImageUrl": "https://stgtickets.imgix.net/images/events/4a7ca56e-881c-4802-b6dd-54d06fb4d1e4.jpeg",
        "category": "FESTIVAL",
        "marketingCategories": [],
        "orderMinimumQuantity": 1,
        "orderMaximumQuantity": 8,
        "seoCanBeIndexed": true,
        "updatedAt": "2024-08-06T09:17:41+00:00",
        "pixels": [
          {
            "type": "view",
            "provider": "facebook",
            "data": {
              "token": 123456
            }
          },
          {
            "type": "addToCart",
            "provider": "facebook",
            "data": {
              "token": 123456
            }
          },
          {
            "type": "orderInfo",
            "provider": "facebook",
            "data": {
              "token": 123456
            }
          },
          {
            "type": "checkout",
            "provider": "facebook",
            "data": {
              "token": 123456
            }
          },
          {
            "type": "purchase",
            "provider": "facebook",
            "data": {
              "token": 123456
            }
          }
        ]
      },
    ]
    
  2. List Events.

    Present the events to the user.

  3. Load Widget.

    Load the Widget using the EATA Loader library. If the event has only one session, it is loaded automatically. Otherwise, it will render a list of sessions -or a calendar- to let the user choose one of them. If the event has more than one session, you can preselect a session using the dataSession if using the data attributes or session if using the object.

    You can choose between these two load methods:

    • Using data attributes.
    <head>
        <script src="https://stg.entradasatualcance.com/js/apps/eata-loader.js"></script>
    </head>
    <div
        id="eata-widget-container"
        data-sales-channel-host="demo.integrations.stg.entradasatualcance.com"
        data-event="{{ eventId }}"
        data-session="{{ sessionId }}" // This is optional
    ></div>
    <script>
        document.addEventListener('DOMContentLoaded', function () {
            eata.loadWidget('#eata-widget-container').ready(function (widget) {
              // ...
            });
        });
    </script>
    
    • Passing an object.
    <head>
        <script src="https://stg.entradasatualcance.com/js/apps/eata-loader.js"></script>
    </head>
    <div id="eata-widget-container"></div>
    <script>
        document.addEventListener('DOMContentLoaded', function () {
            eata.loadWidget('#eata-widget-container', {
              salesChannelHost: 'demo.integrations.stg.entradasatualcance.com',
              event: eventId,
              session: sessionId,
            }).ready(function (widget) {
              // ...
            });
        });
    </script>
    
  4. Get Order.

    The Widget will emit an event after the order creation. The uuid is needed to query the Order details and to Confirm the order. We strongly encourage you to keep it in a safe place while performing these operations.

    <script>
        document.addEventListener('DOMContentLoaded', function () {
            eata.loadWidget(/* ... */).ready((widget) => {
                widget.addEventListener('order.created', (e) => {
                const { order } = e.detail.order;
                fetch('https://my.backend.com/api/order', {
                    method: 'POST',
                    body: JSON.stringify(order),
                    headers: {
                        'Content-Type': 'application/json',
                    },
                }).then(/* ... */);
              });
            });
        });
    </script>
    
  5. Confirm Order.

    Let the user complete the payment through your preferred payment method, then notify the API that the Order has been confirmed. After this step, the Order status will become paid.

    curl -X POST \
        -d "access_token=${ACCESS_TOKEN}"
        "${API_URL}/sell/orders/${ORDER_UUID}/confirm"
    
  6. Get Tickets.

    As the Tickets are asynchronously generated, the Order status endpoint should be polled. Keep checking it until the status is no longer set to paid. A completed Order will be set to completed and the Tickets may then be downloaded through Order tickets.

    We recommend to poll in 1-second intervals up to a maximum of 60 seconds, with an initial delay of 1 second. Normally, the order should be completed within the first second. We can expect that an error has occurred if it is not completed after the grace period.

    for i in $(seq 60); do
        sleep 1
        status=$(curl -X POST \
            -d "access_token=${ACCESS_TOKEN}"
            "${API_URL}/sell/orders/${ORDER_UUID}/confirm" | jq -r .status)
        if [[ "${status}" != "paid" ]]; then
            break;
        fi
    done
    
    if [[ "${status}" == "completed" ]]; then
        curl -X GET \
            -d "access_token=${ACCESS_TOKEN}"
            "${API_URL}/sell/orders/${ORDER_UUID}.pdf"
    else
        >&2 echo "Wrong status: ${status}"
    fi
    

API reference

NOTE: All methods require an access_token

Events catalog

  • This endpoint returns a list with all the events that can be sold at the time being.

    Example of GET call:

    <script>
        var request = new XMLHttpRequest();
    
        request.open('GET', 'https://stg.entradasatualcance.com/api/sell/catalog?access_token=ZWMyNjA2N2ZjZjZjYmViMTcyNTZmNTNmMGE0YTkwNDZhY2UwN2E5NjJkNDcyZDE1YTc4MDllZWExYzY1NTUxMA');
    
        request.setRequestHeader('Accept', 'application/json');
    
        request.onreadystatechange = function () {
            if (this.readyState === 4) {
                console.log('Body:', this.responseText);
            }
        };
    
        request.send();
    </script>
    

    Example of response:

    [
      {
        "categoryDescription": "Festival",
        "sessions": [
          {
            "priceFrom": 40,
            "priceTo": 70,
            "id": 940,
            "name": null,
            "dateFrom": "2024-09-06T10:00:00+00:00",
            "dateFromShowTime": true,
            "dateTo": null,
            "dateToShowTime": true,
            "doorsOpenAt": null,
            "timezone": "Europe/Madrid"
          }
        ],
        "place": {
          "id": 1406,
          "name": "Ciudad deportiva Alcoy",
          "address": "Alcoy",
          "zipcode": "03800",
          "city": "Alcoy",
          "province": "Alicante",
          "country": "ES",
          "timezone": "Europe/Madrid"
        },
        "id": 675,
        "name": "Latina Fest 2024",
        "slug": "latina-fest-2024",
        "description": "\u003Cp\u003E\u003Cstrong\u003ELatina Fest 2024\u003C/strong\u003E, el mayor Beach Festival de Europa está de vuelta. Durante los próximos \u003Cstrong\u003E6\u003C/strong\u003E\u003Cstrong\u003E y 7 de septiembre de 2024\u003C/strong\u003E, \u003Cstrong\u003EAlcoy\u003C/strong\u003E será el epicentro del reggaeton, transmitiendo toda la energía y ganas de petarlo una vez más.\u003C/p\u003E\u003Cp\u003E\u003Cstrong\u003EEl mejor reggaeton\u003C/strong\u003E, la mejor compañía y los recintos más espectaculares que puedas imaginar, te están esperando durante el verano de 2024 para que vivas \u003Cstrong\u003Eel verano de tu vida\u003C/strong\u003E.\u003C/p\u003E\u003Cp\u003E\u003Cstrong\u003EARTISTAS CONFIRMADOS: ANUEL AA | SAIKO | TAINY | TIAGO PZK | BRYANT MYERS | MARIA BECERRA | NIO GARCIA | EL ALFA | ALVARO DIAZ\u003C/strong\u003E\u003C/p\u003E\u003Cp\u003ENo puedes pasar por alto la fecha que reunirá a los mayores amantes del reggaeton y \u003Cstrong\u003Eartistas TOP mundiales\u003C/strong\u003E, escogidos especialmente para la ocasión.\u003C/p\u003E\u003Cp\u003E¿Vas a dejar escapar la oportunidad de vivir \u003Cstrong\u003Eel evento más esperado del año\u003C/strong\u003E y de disfrutar de los mejores artistas del mundo?\u003C/p\u003E\u003Cp\u003ENo pierdas la oportunidad de vivir la mejor experiencia del verano y ¡\u003Cstrong\u003Ecompra ya tus entradas\u003C/strong\u003E!\u003C/p\u003E\u003Cp\u003E\u003Cbr /\u003E\u003C/p\u003E\u003Ch4\u003EPOLÍTICA DE MENORES\u003C/h4\u003E\u003Cp\u003EEdad mínima de acceso 16 años.\u003C/p\u003E\u003Cp\u003EMenores con 16 y 17 años con autorización firmada por padre/madre/tutor legal. \u003C/p\u003E\u003Cp\u003E\u003Ca\u003EDescarga aquí tu autorización.\u003C/a\u003E\u003C/p\u003E",
        "descriptionImage": "799afa19-142a-4480-9afb-92b622bfe63e.jpeg",
        "organizer": {
          "id": 1,
          "name": "TECTELTIC ON-LINE SL"
        },
        "logo": "eb569fa8-1cdf-418a-adf7-2111702e7856.jpeg",
        "logoUrl": "https://stgtickets.imgix.net/images/events/eb569fa8-1cdf-418a-adf7-2111702e7856.jpeg",
        "headerImage": "4c1ed0b1-8d58-43f3-9978-44cb9bb5d4ec.jpeg",
        "headerImageUrl": "https://stgtickets.imgix.net/images/events/4c1ed0b1-8d58-43f3-9978-44cb9bb5d4ec.jpeg",
        "widgetImage": "4a7ca56e-881c-4802-b6dd-54d06fb4d1e4.jpeg",
        "widgetImageUrl": "https://stgtickets.imgix.net/images/events/4a7ca56e-881c-4802-b6dd-54d06fb4d1e4.jpeg",
        "category": "FESTIVAL",
        "marketingCategories": [],
        "orderMinimumQuantity": 1,
        "orderMaximumQuantity": 8,
        "seoCanBeIndexed": true,
        "updatedAt": "2024-08-06T09:17:41+00:00",
        "pixels": [
          {
            "type": "view",
            "provider": "facebook",
            "data": {
              "token": 123456
            }
          },
          {
            "type": "addToCart",
            "provider": "facebook",
            "data": {
              "token": 123456
            }
          },
          {
            "type": "orderInfo",
            "provider": "facebook",
            "data": {
              "token": 123456
            }
          },
          {
            "type": "checkout",
            "provider": "facebook",
            "data": {
              "token": 123456
            }
          },
          {
            "type": "purchase",
            "provider": "facebook",
            "data": {
              "token": 123456
            }
          }
        ],
        "recaptchaSiteKey": "6Ldf8fciAAAAAIFol3X1p6WiWO5Vl_iUFHucsJLV"
      },
    ]
    

Search orders

  • List orders made within the selected date range.

    Example of GET call:

    <script>
        var request = new XMLHttpRequest();
    
        request.open('GET', 'https://stg.entradasatualcance.com/api/sell/orders?access_token=ZWMyNjA2N2ZjZjZjYmViMTcyNTZmNTNmMGE0YTkwNDZhY2UwN2E5NjJkNDcyZDE1YTc4MDllZWExYzY1NTUxMA&search%5BdateFrom%5D=2024-04-30T22%3A00%3A00.000Z&search%5BdateTo%5D=2024-08-04T00%3A00%3A00.000Z&search%5Bcode%5D=EATA12345678ABC&search%5Bstatus%5D=new');
    
        request.setRequestHeader('Accept', 'application/json');
    
        request.onreadystatechange = function () {
            if (this.readyState === 4) {
                console.log('Body:', this.responseText);
            }
        };
    
        request.send();
    </script>
    

    Parameters

    • access_token
      Required

      Access token.

      Example: WrtPjmtjUyKTNf6cGUX79ymQ2PDQfCHRDcqdA6dHhjPVNapV.

    • search[dateFrom]
      Optional

      Show orders created after given date. Date must be represented in ISO 8601.

      Example: 2024-04-30T22:00:00.000Z.

    • search[dateTo]
      Optional

      Show orders created before given date. Date must be represented in ISO 8601.

      Example: 2024-08-04T00:00:00.000Z.

    • search[code]
      Optional

      Show orders containing given code.

      Example: EATA12345678ABC.

    • search[status]
      Optional

      Show orders in given status

      Example: new.

Order details

  • Returns the details of an order.

    Example of GET call:

    <script>
        var request = new XMLHttpRequest();
    
        request.open('GET', 'https://stg.entradasatualcance.com/api/sell/orders/{{order_uuid}}?access_token=ZWMyNjA2N2ZjZjZjYmViMTcyNTZmNTNmMGE0YTkwNDZhY2UwN2E5NjJkNDcyZDE1YTc4MDllZWExYzY1NTUxMA');
    
        request.setRequestHeader('Accept', 'application/json');
    
        request.onreadystatechange = function () {
            if (this.readyState === 4) {
                console.log('Body:', this.responseText);
            }
        };
    
        request.send();
    </script>
    

    Parameters

    • order_uuid
      Required

      Order UUID

      Example: 6127b886-ce51-49e3-87dd-cbcbf13e677b.
    • access_token
      Required

      Access token.

      Example: WrtPjmtjUyKTNf6cGUX79ymQ2PDQfCHRDcqdA6dHhjPVNapV.

Order confirmation

  • Used to confirm an order and set it as paid.

    Example of POST call:

    <script>
        var request = new XMLHttpRequest();
    
        request.open('POST', 'https://stg.entradasatualcance.com/api/sell/orders/{{order_uuid}}/confirm?access_token=ZWMyNjA2N2ZjZjZjYmViMTcyNTZmNTNmMGE0YTkwNDZhY2UwN2E5NjJkNDcyZDE1YTc4MDllZWExYzY1NTUxMA');
    
        request.setRequestHeader('Accept', 'application/json');
    
        request.onreadystatechange = function () {
            if (this.readyState === 4) {
                console.log('Body:', this.responseText);
            }
        };
    
        request.send();
    </script>
    

    Parameters

    • order_uuid
      Required

      Order UUID

      Example: 6127b886-ce51-49e3-87dd-cbcbf13e677b.
    • access_token
      Required

      Access token.

      Example: WrtPjmtjUyKTNf6cGUX79ymQ2PDQfCHRDcqdA6dHhjPVNapV.

Order status

  • Used to check an order status.

    Example of GET call:

    <script>
        var request = new XMLHttpRequest();
    
        request.open('GET', 'https://stg.entradasatualcance.com/api/sell/orders/{{order_uuid}}/status?access_token=ZWMyNjA2N2ZjZjZjYmViMTcyNTZmNTNmMGE0YTkwNDZhY2UwN2E5NjJkNDcyZDE1YTc4MDllZWExYzY1NTUxMA');
    
        request.setRequestHeader('Accept', 'application/json');
    
        request.onreadystatechange = function () {
            if (this.readyState === 4) {
                console.log('Body:', this.responseText);
            }
        };
    
        request.send();
    </script>
    

    Parameters

    • order_uuid
      Required

      Order UUID

      Example: 6127b886-ce51-49e3-87dd-cbcbf13e677b.
    • access_token
      Required

      Access token.

      Example: WrtPjmtjUyKTNf6cGUX79ymQ2PDQfCHRDcqdA6dHhjPVNapV.

Order tickets

  • Used to download the tickets for an order.

    Example of GET call:

    <script>
        var request = new XMLHttpRequest();
    
        request.open('GET', 'https://stg.entradasatualcance.com/api/sell/orders/{{order_uuid}}.pdf?access_token=ZWMyNjA2N2ZjZjZjYmViMTcyNTZmNTNmMGE0YTkwNDZhY2UwN2E5NjJkNDcyZDE1YTc4MDllZWExYzY1NTUxMA');
    
        request.setRequestHeader('Accept', 'application/json');
    
        request.onreadystatechange = function () {
            if (this.readyState === 4) {
                console.log('Body:', this.responseText);
            }
        };
    
        request.send();
    </script>
    

    Parameters

    • order_uuid
      Required

      Order UUID

      Example: 6127b886-ce51-49e3-87dd-cbcbf13e677b.
    • access_token
      Required

      Access token.

      Example: WrtPjmtjUyKTNf6cGUX79ymQ2PDQfCHRDcqdA6dHhjPVNapV.

Order refund

  • Used to refund an order.

    Example of POST call:

    <script>
        var request = new XMLHttpRequest();
    
        request.open('GET', 'https://stg.entradasatualcance.com/api/sell/orders/{{order_uuid}}/payment/refund?access_token=ZWMyNjA2N2ZjZjZjYmViMTcyNTZmNTNmMGE0YTkwNDZhY2UwN2E5NjJkNDcyZDE1YTc4MDllZWExYzY1NTUxMA');
    
        request.setRequestHeader('Accept', 'application/json');
    
        request.onreadystatechange = function () {
            if (this.readyState === 4) {
                console.log('Body:', this.responseText);
            }
        };
    
        request.send();
    </script>
    

    Parameters

    • order_uuid
      Required

      Order UUID

      Example: 6127b886-ce51-49e3-87dd-cbcbf13e677b.
    • access_token
      Required

      Access token.

      Example: WrtPjmtjUyKTNf6cGUX79ymQ2PDQfCHRDcqdA6dHhjPVNapV.

Widget