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.weeztix.com/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.weeztix.com/shop/$shopGUID/payment_methods"
]);

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

echo $response;
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.

BotProt token​

Send the final BotProt token in the x-botprot-verification header, the same token you used for the reservations. A token for another shop is refused. If the order gets a 403, for example because the token expired after the reservations, see When the token is refused.

Creating orders​

After you have collected all the required information, you can make a POST request to

https://shop.api.weeztix.com/: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",
"x-botprot-verification: $botprotToken"
],
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.weeztix.com/$GUID/order"
]);

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

echo $response;
Response
{
"fatals": [],
"errors": [],
"notices": [],
"redirectUrl": "https://api.weeztix.com/3.0.0/return/56fd3b40-611c-11ee-bb11-d3ad4a9c37eb",
"amount": 0,
"order_id": "56f5e720-611c-11ee-8dc2-455b4c4323d2"
}
caution

This request goes to the Shop API (https://shop.api.weeztix.com), not the API used in the sections before. See API and Shop API.

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.

After the order​

The token can't be used for another order in this shop. BotProt keeps the final token in the browser until it expires, and a new run for the same shop resolves to that stored token. So clear the stored token before the customer's next order, see Refresh and persistence.