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;
This request results in the following response
[
{
"guid": "2f01a3c0-3668-11e6-9fa9-419d70281599",
"name": "iDeal",
"pivot": {
"shop_id": "7d2bb3a8-739b-41c8-afe0-80b66f70943a",
"payment_method_id": "2f01a3c0-3668-11e6-9fa9-419d70281599"
}
},
{
"guid": "2f01a3c0-3668-11e6-9fa9-419d70281600",
"name": "Bancontact",
"pivot": {
"shop_id": "7d2bb3a8-739b-41c8-afe0-80b66f70943a",
"payment_method_id": "2f01a3c0-3668-11e6-9fa9-419d70281600"
}
},
{
"guid": "2f01a3c0-3668-11e6-9fa9-419d70281610",
"name": "Sofort",
"pivot": {
"shop_id": "7d2bb3a8-739b-41c8-afe0-80b66f70943a",
"payment_method_id": "2f01a3c0-3668-11e6-9fa9-419d70281610"
}
}
]

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;
This request results in the following response
{
"fatals": [],
"errors": [],
"notices": [],
"redirectUrl": "https://api.openticket.tech/3.0.0/return/56fd3b40-611c-11ee-bb11-d3ad4a9c37eb",
"amount": 0,
"order_id": "56f5e720-611c-11ee-8dc2-455b4c4323d2"
}
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.