Book one or more users onto a course date.
Use this API call to create a new order. The response body will contain a summary with the id of the newly created order.
For every API request you make, you'll need to present the API access key in the HTTP Header as X-API-Key to be authenticated.
Name | Required | Value | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
coursedate_id | required | number | Course date identifier. i.e. 12792066 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
payment_method | required | string | Currently only 'invoice' is supported | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
currency | optional | string | Three-letter ISO currency code, in lowercase. Must be a supported currency. Exchange rate must exist for the selected currency ISO code. Defaults to selected standard currency. Supported currencies:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
campaign_code | optional | string | Campaign code if any | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
voucher_code | optional | string | Voucher code if any | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
booker_name | optional | string | Booker name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
booker_email | optional | string | Booker email | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
booker_phone | optional | string | Booker phone number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
company | optional | string | Company name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
company_number | optional | string | Orgnr. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gln_number | optional | string | GLN Number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_reference | optional | string | Invoice reference | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_address_1 | optional | string | Invoice address line 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_address_2 | optional | string | Invoice address line 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_address_3 | optional | string | Invoice address line 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_zipcode | optional | string | Invoice zipcode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_city | optional | string | Invoice city | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_email | optional | string | Invoice email | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_firstname | optional | string | Invoice firstname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_lastname | optional | string | Invoice lastname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
invoice_phone | optional | string | Invoice phone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
participants | required | array |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
config | optional | object |
|
If the method is successful it responds with an JSON structure, as it is shown below.
{ "successful": true, "summary": { "order_id": "221530", "booking_id": "472721", "coursedate_id": "12792066", "currency": "nok", "total_before_discounts": 1250, "total_calculated_discounts": 0, "total_excl_vat": 1250, "total_incl_vat": 1375, "total_vat": 125, "number_of_participants": 1, "payment_redirect_url" : null } }
Unsuccessful response sample:
{ "successful": false, "errors": [ { "code" => some_error_code, "message" => "A human readable error response" } ] }
{ "coursedate_id": "12761394", "payment_method": "invoice", "currency": "usd", "booker_name": "Jane Doe", "booker_email": "jane@example.com", "booker_phone": "12345678", "company": "Example Company Inc", "company_number": 123456789, "invoice_reference": "Ref 1234", "invoice_address_1": "125 Holburn Lane", "invoice_address_2": "", "invoice_address_3": "", "invoice_zipcode": "0262", "invoice_city": "Heckfordbridge", "invoice_email": "invoice@example.com", "invoice_firstname": "Jane", "invoice_lastname": "Doe", "invoice_phone": "12398765", "participants": [ { "firstname": "John", "lastname": "Doe", "date_of_birth" : "1979-12-01", "email": "john@example.com", "phone": "987654321", "price" : 5999, "status_id": 1, "products": [ { "id": 25883, "title": "Exam", // Added for clarity. Documentation only. "price": 100, "discount_percent": 50 } ], "home_address": { "address_line_1": "125 Holburn Lane", "address_line_2": "", "address_line_3": "", "zipcode": "0262", "city": "Heckfordbridge" }, "work_address": { "address_line_1": "125 Holburn Lane", "address_line_2": "", "address_line_3": "", "zipcode": "0262", "city": "Heckfordbridge" } } ], "config": { "auto_append_course_product" : true, "allow_customer_autoconnect" : true, "allow_user_autoconnect" : true, "send_account_created_email_to_user" : true, "send_receipt_email_to_participant" : true } }
{ "payment_method": "invoice", "coursedate_id": "12761394", "participants": [ { "firstname": "John", "lastname": "Doe", "email": "john@example.com", "price" : 1250 // This will override the price from the automatically appended main course product. } ], "config": { "auto_append_course_product" : true } }
school_account_invalid | The school account provided through the api token is not valid. Check that your requests are specifying a valid account token. |
course_identifier_invalid | Course identifier is missing or invalid. Check that your requests are specifying a valid course date ID. |
course_date_identifier_invalid | Course date identifier is missing or invalid.. Check that your requests are specifying a valid course date ID. |
default_course_product_missing | The course price is missing. The course is not correctly configured. |
currency_missing | Currency is either missing or not supported. |
exchange_rate_does_not_exist | Occurs when a currency has been specified which does not have a exchange rate in the settings section |
participant_name_invalid_empty | Participant {index} must have a name specified. Make sure requests include all required parameters. |
participant_email_invalid_empty | Participant {index} must have an email address. Make sure requests include all required parameters. |
participant_products_empty | Participant {index} must have a product. No course product found. Make sure that all participants have at least a course product. |
participant_products_invalid | One of the products for participant {index} have an invalid id: {product_id}. Make sure that product ID exists on the platform. |
participant_does_not_have_a_course_product | Participant {index} is missing the course product. |
participant_have_multiple_course_products | Participant {index} is multiple course products. Only 1 course product pr. participant. |
participant_product_price_invalid | Participant must have a price. Check that you have a price set for all participants. |
participant_count_invalid | No participants found. At least one participant must be added to complete the booking. |
internal_course_order_not_resolvable | Could not resolve order for this course. |
internal_course_orderline_not_resolvable | Could not resolve the main orderline for this course. |
booking_could_not_be_created | Booking could not be created. |
order_could_not_be_created | Order could not be created. |
campaign_code_invalid | The campaign code provided is not valid. |
campaign_code_expired | The campaign code has expired. |
voucher_code_invalid | The voucher code provided is not valid. |
voucher_code_expired | The voucher code has expired |