Overview
In the previous sections of the documentation you created a shop. As
you have seen already, the OpenTicket provides an interface at
https://shop.openticket.tech through which customers can buy tickets. However, you are
also able to create such a shop yourself through the OpenTicket API. This is done by creating
orders. At a high level, this process has the following steps:
- The customer passes BotProt, and you receive a token.
- The customer reserves a ticket (this reservation is dropped after 8 minutes).
- The customer completes their order, that is:
- The customer supplies the required information.
- The customer completed the payment for the tickets.
- The order is created, and the customer receives their ticket.
In this part of the documentation, you will be guided through this process.
Before you start
Every reservation and order request needs a final BotProt token for that shop. Without it, the Shop
API refuses the request with a 403. So before the customer reserves a ticket, run BotProt in their
browser with the shop's GUID as identifier:
const token = await window.OpenTicket.createBotProt(shopGuid);
Then send the token in the x-botprot-verification header on every reservation and order request.
When the shop has no steps the visitor solves, the customer sees nothing, but the token can take a
moment. Wait for it before the first reservation.
Read the BotProt overview for the token rules, and Integration for loading the script.
Resources
The Entity Relation (ER) diagram shown above omits some of the associations shown in the previous
sections. This is done to keep a clear overview of the resources used in this part of the
documentation. The remainder of the section explains the new order resource. You can find the
explanation of the ticket and shop resources in a previous section
of the documentation.
Order
Orders are nothing more than the purchase of one or more tickets and have to be stored in the
OpenTicket system. An order resource is relatively easy to create, but contains a lot of
information. It also contains information regarding its associations with ticket and shop
resources.
First and foremost, an order should contain the tickets that have been bought. Therefore, it is
associated with at least one, but possibly many ticket resources. On the other hand, a ticket can
be ordered by many people. Therefore, a ticket can also be associated with none or many order
resources. Furthermore, an order always contains the shop through which it was created. This
allows you to keep an overview of what tickets have been bought through which shops. You can create
an order through exactly one shop, but there are many order resources that can be created by
different customers through a single shop.
Notes
As you will see in the following sections, creating an order is a relatively simple process. However, it is important to keep in mind that most of what is happening is not visible to the customer. During, but also after the creation of an order, you should keep the customer up-to-date with about what is happening with their order. This, for example, can be done by providing the customer with a clear overview of their order after it has been completed.
Furthermore, there are multiple ways to provide a customer with their tickets after their order has been completed. The simplest way is sending the download link to the customer by mail, and this is also how the OpenTicket system does this by default. However, you can slightly alter this process if desired.