The booking process allows you to book an event. Once you have found the Event you want to book, using the search or browsing the catalogues, for a successful booking you have to follow this flow.
We assume you already retrieved the all the infomation for the Event using the call:
GET /api/v3/events/{id}
- Search for the available dates for the Event. | Test it
Returns a list of all days with availabitiy for a specific Event over a period of time.
GET /api/v3/events/{id}/dates
To specify the period you can use the parameters from_date and end_date. If none of these parameters are specified from_date is set to the current day. If end_date is not specified then end_date is set to the same as from_date.
Examples:
*** No parameters ***
from_date and end_date are set as the current day. This call returns the current date if there is availabitiy, an empty array otherwise.
GET /api/v3/events/497/dates
*** With parameters ***
Search for available dates for December 2016
GET /api/v3/events/497/dates?from_date=2016-12-01&end_date=2016-12-31
Example Response:
The response is a collection of dates
[
{
"date": "2016-01-14"
},
{
"date": "2016-01-25"
}
]
Once you have found the date, the next step is to search for all available tickets for that day. Please note that for the same event different days can have different types of tickets.
GET /events/{id}/dates/{YYYY-MM-DD} | [Test it]
The response is a collection of items containing :
datetime- The date and time. For a single day an event may have multiple starting times.seats- A collection of all availableseats(AKAtickets). Here you can find the seat structure.open_ticket- If true the event is anOpen ticketavailability- Number of place availablelanguages- The event may be available in different languages. Different times may also have different languages
seat structure:
id- Unique seat identifierprice_tag- Info about theseat(person) the ticket is for: ticket type (name) and type of person (group). Please note that for the same date and time the combination ofnameandgroupis unique but you can have multiple seats with the samegroupornamemax_buyandmin_buy- Maximum and minimum number of ticket purchasable in a single transactionraw_priceandretail_price- Internal and public price
GET /api/v3/events/497/dates/2016-01-15
Response
[
{
"datetime": "2016-01-14T13:45:00+0000",
"seats": [
{
"id": 8216618,
"price_tag": {
"name": "Full price",
"group": "Tour",
"locale": "en"
},
"max_buy": 15,
"min_buy": 1,
"raw_price": {
"currency": "EUR",
"value": 40,
"formatted_value": "€ 40.00"
},
"retail_price": {
"currency": "EUR",
"value": 40,
"formatted_value": "€ 40.00"
}
}
],
"open_ticket": false,
"availability": 9,
"languages": [
"en"
]
}
]
When the cart is completed (with customer info filled in) and you want to finalize it (proceed with payments and check the availability one last time)
POST /api/v3/orders
{
"cart_id": 123456
}
(See api docs for more details)
You'll get the order id as response. Once you have the order id you can pay your order. If the order amount is equal to 0 or you use your payment gateway, use the flow without payment (ask for activation). Otherwise follow the Braintree Payments flow
POST /api/v3/payments/no-payment
{
"orderId": 123456
}
(See api docs for more details)
You have to integrate Braintree SDK
Note When testing use credit card numbers contained in this link https://developers.braintreepayments.com/reference/general/testing/php#credit-card-numbers
Get client token :
POST /api/v3/payments/braintree/token
Response
{
"token": "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiI3MDVjY2JlZThmZDRkNzI3MW"
}
(See api docs for more details)
Using Braintree SDK, ask the user for payment information (credit card, paypal etc) and generate "payment method nonce". Look at the Braintree documentation for custom integrations or Drop-in Payment UI for more details.
After the user fills out the Braintree payment form and you have "payment method nonce", ask us to process the payment and close the order by sending a
POST /api/v3/payments/braintree/payment
{
"nonce" : "nonce_string",
"orderId" : 123456
}
