Skip to main content

Reservations

Before you can buy a ticket, it first needs to be reserved in the Weeztix system. Only when a ticket has been reserved, it can be added to an order. This system has two benefits. Firstly, reservations allow you to finish their order in a reasonable time without being rushed. Secondly, by requiring a ticket to be reserved before it can be added to an order, it will never happen that more tickets are ordered than that there are available.

Reservations last for 8 minutes, and have to be made for every ticket that need to be part of an order. After the 8 minutes have passed, a reservation will automatically drop, and a ticket had to be reserved again before the process of creating an order can continue.

Creating reservations​

Thus, you first need to reserve a ticket. For this, you need the following information:

  • shopGUID: the GUID of the shop through which the ticket will be sold.
  • ticketGUID: the GUID of the ticket which is being ordered.
  • botprotToken: a final BotProt token for this shop. Run BotProt in the customer's browser with the shop's GUID as identifier, see Integration.

Use the required information to make a GET request to

https://shop.api.openticket.tech/:shopGUID/reserve/ticket/:ticketGUID. The GUIDs go in the endpoint URL, the token goes in the x-botprot-verification header. See the following code blocks for examples of such requests.

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-botprot-verification: $botprotToken"
],
CURLOPT_URL => "https://shop.api.openticket.tech/$shopGUID/reserve/ticket/$ticketGUID"
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;
Response
{
"reservation": "3bb763e0-611c-11ee-8764-cfd48e22cbd7",
"childReservations": {
"Product": {
"1b3760ca-c999-4b24-8e51-ea4ab4552957": [
"3bb59850-611c-11ee-abed-a91d3fef3b1b"
],
"23e91fdb-9a37-41eb-8a5c-c1cb4bc66a18": [
"3bb6d550-611c-11ee-9919-75d519897a5f"
]
}
}
}

The response to the request indicates that a ticket has successfully been reserved. As you can see, the response contains a product fields as well. These fields are used to complete an order, but will not be explained in depth. However, note that the GUIDs listed correspond to the ticketGUID and the GUID of the eventDate attached to this ticket.

When the token is refused​

The same checks apply to reservations and orders:

  • 403: the Shop API refused the token. The response doesn't say why, because an expired token gets the same 403 as one that isn't valid. To find out, run BotProt again with this shop's GUID as identifier and compare the new token with the refused one:

    • A different token: the refused one had expired, was for another shop, or didn't come from this browser's BotProt run. Retry once with the new token. A reservation lasts 8 minutes and a token about an hour, so a token can expire during checkout.
    • The same token: BotProt still holds it, so it hasn't expired, and a retry gets the same 403. Stop and show the customer an error. The customer is blocked, for example because they already placed an order in this shop.
    const newToken = await window.OpenTicket.createBotProt(shopGuid);
    if (newToken !== refusedToken) {
    // Retry the request once with newToken.
    }
  • 429: the customer sent too many requests in a short time, or reserved more tickets than the shop allows per order. Wait before you retry, or release reservations first.

Releasing a reservation with a DELETE request works without a token.

caution

These requests go to the Shop API (https://shop.api.weeztix.com), not the API used in the sections before. See API and Shop API.