Wix-events API: Checking out more than one guest

The event ticket registration flow is clear in the API documentation: Reserve tickets → Validate form → Checkout → Update order.

And wixEvents . tickets . reserve() allows us to reserve more than one type of ticket at a time. However, wixEvents . tickets . checkout() does not allow for more than one form to be submitted!

If I have two tickets:

    let tickets = [{
            "ticketId": "c16d5d89-a7af-4718-b700-74dc586ec7e8",
            "quantity": 1
        },
        {
            "ticketId": "410b9922-fde2-491c-ab1c-00677229e8c1",
            "quantity": 1
        }
    ];

I can reserve them and get back a reservation ID successfully:

let reservationId = await wixEvents.tickets.reserve(eventId, tickets)

The event in the backend requires guests to “Fill out a registration form for each ticket in an order”.

So I for these two tickets I have two formValues arrays setup (as per the docs), along with the reservation ID, that should be enough to checkout the tickets:

let orderNumber = await wixEvents.tickets.checkout(eventId, reservationId, {
            "formValues": formValues
        })

HOWEVER, tickets.checkout only takes one array of formValues, not an array of formValues as it should, given there are more than one ticket types reserved. As a result, I get this error:

{“message”: “Guests forms size must be equal to tickets quantity: 1 != 2”,“details”:{“error_key”:“INVALID_REQUEST”}

How are we supposed to register more than one guest using the API?

1 Like

Hi! Based on the error message you received, it seems that the API requires a separate registration form for each ticket in an order. So in your case, since you have two tickets, you would need to submit two separate formValues arrays, one for each ticket.

It should have been clear from the text of my post (as well as the API document) that the API doesn’t allow for an array of arrays. It is restricted to accepting only one formValues array. Even though it accepts multiple ticket reservations.

This seems like a bug or at least a major design oversight given that both the REST API and wix-events.v2 accept multiple arrays, as this should too. However, both REST and v2 are on developer preview and should not be used in production.

Perhaps a kind and wise Wix.com expert could shed some light? @yisrael-wix