Skip to main content

Creating orders

Required information

In the previous section, you reserved a ticket that needs to be part of the order. Without this reservation, an order cannot be created. Now that the reservation is made, you have 8 minutes to create an order. To create an order, you need quite a bit of information. To keep the overview clear, the required information is split up in separate sections.

Receiver information

An order must contain information about the customer that is making the order:

  • locale: the language- or country-based preferences of the customer.
  • email: the email address of the customer.
  • firstname: the first name of the customer.
  • lastname: the last name of the customer.

The email is used to send the physical tickets to the customer. These physical tickets also contain all the information of the customer. The locale indicates in what language the customer will receive mails, as well as what language is used on the ticket.

Payment information

Before an order can be created, the payment for that order has to be completed. To provide this payment, you need the following information:

  • currency: the currency used to pay for the order.
  • paymentProviderGUID: the GUID of the payment method that should be used to pay for the order.
  • shopGUID: the GUID of the store through which the ticket is sold.

For the paymentProvider, you have to check which providers are available for the store through which the order is created. You can do this by making a GET request to https://api.openticket.tech/shop/:shopGUID/payment_methods. See the following code blocks for examples of such requests and the expected response to the requests.

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $accessToken"
],
CURLOPT_URL => "https://api.openticket.tech/shop/$shopGUID/payment_methods"
]);

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

echo $response;

You can list these payment options in your own shop interface, and use the GUID of the payment method that the customer chooses for the paymentProvider field.

Ticket information

You also need information about the ticket that have to be part of the order. All of this information was acquired in the previous section when creating a reservation for a ticket.

  • guid: the GUID of the ticket that has been reserved.
  • reservation: the GUID of the reservation.
  • ticketGUID: the GUID of the ticket that has been reserved.
  • ticketChildReservationGUID: the GUID of the child reservation associated with the ticket.
  • eventDateGUID: the GUID of the eventDate associated with the ticket.
  • eventDateChildReservationGUID: the GUID of the child reservation associated with the eventDate.

Creating orders

After you have collected all the required information, you can make a POST request to https://shop.api.openticket.tech/:shopGUID/order. Containing all of this information. See the following code blocks for examples of such requests and the expected response to the requests.

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => [
"receiver" => [
"locale" => "nl_NL",
"email" => "jane.appleseed@example.com",
"firstname" => "Jane",
"lastname" => "Appleseed"
],
"paymentProvider" => $paymentProviderGUID,
"currency" => "EUR",
"tickets" => [
[
"guid" => $ticketGUID,
"reservation" => $reservationGUID,
"products" => [
[
"guid" => $ticketGUID,
"reservation" => $ticketChildReservationGUID
],
[
"guid" => $eventDateGUID,
"reservation" => $eventDateChildReservationGUID
]
]
]
]
],
CURLOPT_URL => "https://shop.api.openticket.tech/$GUID/order"
]);

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

echo $response;
caution

For the shown API requests, the https://shop.api.openticket.tech endpoint is used, which is slightly different from the https://api.openticket.tech endpoint that was used in the documentation thus far.

After the order has been created, the customer will be sent the physical ticket(s) by mail (unless this has specifically been disabled), meaning that the order is now completed.