Book users onto course date

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. How the price of each participant is worked out is explained under Prices, below the parameters.

Request

POST https://api.frontcore.com/v2/booking

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.

Parameters

Name Required Value Description
coursedate_id required number Course date identifier. i.e. 12792066
payment_method required string

The payment_method parameter defines the type of payment method to be used.
Currently, the supported options are invoice and card_swedbank.

Information related to card payments

When the card_swedbank payment method is selected, you must check the requires_redirect flag within the payment_details to determine if a redirect is required.

  • If requires_redirect is set to true, the customer must be redirected to the URL specified in the redirect_url field within payment_details to complete the payment.
  • For orders with a zero amount, Swedbank typically does not support zero-amount card transactions, so a redirect is usually unnecessary in this case.

Additionally, you can provide custom URLs for payment completion or cancellation by using the optional payment_complete_url and payment_cancel_url parameters.

Example payment_details (found at the bottom in the response) for a redirect scenario:

{
  ...
  "payment_details": {
        "payment_type": "card",
        "requires_redirect": true,
        "payment_session_id": "61303e7d-55b6-4a3e-8995-5c679c0138b1",
        "redirect_url": "https://somepaymentprovider.com/creditcard/payments/authorize/440996e71a469eb69c544218e5a933d29dcff1088d36ba68b76251df126d2dc7"
    }
}

You can use other endpoints like i.e. GET /v2/orders/:id to enrich the (optional) custom payment complete page if needed.

is_paid optional boolean Set to true to register the order as already paid, e.g. when it was paid outside FrontCore. The order and every participant on it are marked paid, exactly as PUT /v2/orders/:id with is_paid does, before any receipt or webhook goes out. Default: false.
Not available with card payment, on company internal courses (whose bookings share one order), or when booking a partner's course; those requests are rejected with 400.
payment_complete_url optional string Card payment only. This URL will be used to redirect the user after a successful payment. You can also use other endpoints, such as GET /v2/orders/:id, to enhance the optional custom payment completion page with additional information if needed.
"payment_complete_url": "https://example.com/payment/success"
payment_cancel_url optional string Card payment only. This URL will be used to redirect the user if the payment is canceled
"payment_cancel_url": "https://example.com/payment/cancel"
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:
  • aed = Emirati dirham
  • all = Albanian lek
  • aud = Australian dollars
  • brl = Brazilian real
  • byr = Belarussian ruble
  • cad = Canadian dollar
  • chf = Swiss franc
  • cny = Chinese yuan
  • czk = Czech koruna
  • dkk = Danish kroner
  • eur = Euro
  • gbp = British pounds
  • huf = Hungarian forints
  • idr = Indonesian Rupiah
  • ils = Israeli shekel
  • inr = Indian rupee
  • isk = Icelandic krona
  • jpy = Japanese yen
  • ltl = Lithuanian litas
  • mxn = Mexican peso
  • nok = Norwegian kroner
  • pln = Polish zloty
  • ron = Romanian leu
  • rsd = Serbian dinar
  • rub = Russian rubles
  • sar = Saudi Arabian Riyal
  • sek = Swedish kroner
  • sgd = Singapore dollar
  • usd = US dollar
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
Name Required Value Description
firstname required string Participant firstname
lastname required string Participant lastname
price optional
The price of the course product
string The price of the course for this participant, before VAT, in the booking's currency. FrontCore adds VAT at the rate set on the course product. Leave it out to use the price set up in FrontCore (or the price engine's price, with config.use_price_engine). See Prices below the parameters.

email required string Participant email
phone optional string Participant phone number
company optional string Participant company
company_number optional string Participant company number
position optional string Participants job title
date_of_birth optional string YYYY-MM-DD
country optional string Participant country
comment optional string Comment
national_identification_number optional string Participant national identification number
status_id optional string Status id for the attender
  • 1 = Confirmed
  • 2 = Overbooked
  • 3 = Waiting list
  • 7 = Unconfirmed
home_address optional object
Name Required Value Description
address_line_1 optional string Address line 1
address_line_2 optional string Address line 2
address_line_3 optional string Address line 3
zipcode optional string Zipcode
city optional string City
work_address optional object
Name Required Value Description
address_line_1 optional string Address line 1
address_line_2 optional string Address line 2
address_line_3 optional string Address line 3
zipcode optional string Zipcode
city optional string City
products required

Required if configuration 'auto_append_course_product' is set to false
array
Name Required Value Description
id required integer The product id. This is the only property that is truly required.
price optional float The price of this product, before VAT, in the booking's currency. FrontCore adds VAT at the rate set on the product. Leave it out to use the price set up in FrontCore. For the course itself, use price on the participant instead; it takes precedence over this one.
discount_percent optional float Discount as percent. Discount as percent has precedence and will be used if set.
discount_amount optional float Discount as amount. If discount as percent is used this will be disregarded.
custom_properties optional

Use custom properties to set meta data on each participant. Use key names up to 40 characters long. Value must be string up to 255 characters. A custom field set up as a date takes ISO 8601, see Date fields.
object
Name Required Value Description
my_custom_property_1 optional string Any value as long as its max 255 characters
my_custom_property_2 optional string Any value as long as its max 255 characters
config optional object
Name Required Value Description
reject_cancelled_course_date optional boolean If set to true, the booking will be rejected if the course date has been cancelled. Default: true
seats_availability_check optional boolean Set this value to true to enforce seat availability check. This will throw an error if there are no vacant seats. Default: false
auto_append_course_product optional boolean If this property is set to true the main product and price from the course will be automatically added to each participant. Default: true
use_price_engine optional boolean Prices the course's own prices the same way as GET /v2/price-quote and FrontCore's own booking form: the rate plan for the course date's location and month, then the price rules, at the time of booking and in the booking's currency. Member prices and add-on products keep their product price. A price you send (on the participant for the course price, on the product for others) still wins. A campaign_code discount is applied on top only when no price rule applied, or the rule allows combining with campaigns. If no price can be calculated, the product price is used. With quote, the response lists each line's price and the rule and rate plan used. Default: false
allow_customer_autoconnect optional boolean If this property is set to true and a company name and/or company number is set, the system will try to automatically connect to an existing customer in FrontCore. Default: true
allow_user_autoconnect optional boolean If this property is set to true and a user with the same name and email is found, the system will try to automatically connect existing to an existing user in FrontCore. Default: true
send_account_created_email_to_user optional boolean If this property is set to true a welcome email with username and password will be sent to the user. Default: true
send_receipt_email_to_participant optional boolean If this property is set to true an email receipt will be sent to the user. Default: true

Prices

Which price a line gets

Every participant gets one order line per product: the course itself, plus any add-on products. For each line, FrontCore uses the first of these prices that applies:

  1. A price you send. For the course, put price on the participant. For an add-on product, put price on that product. FrontCore uses your price exactly as sent, without comparing it to any price set up in FrontCore.
  2. The price engine, only if you send "config": { "use_price_engine": true }. The course's price is then worked out the same way as in FrontCore's own booking form and in GET /v2/price-quote: the course's rate plan, then any price rules (such as early-bird). Member prices and add-on products are not affected.
  3. The price set on the product in FrontCore. This is what you get when you send no price and don't use the price engine.

A participant with their own course price (2400) and an add-on product with its own price (400):

"participants": [
    {
        "firstname": "John",
        "lastname": "Doe",
        "email": "john@example.com",
        "price": 2400,
        "products": [
            { "id": 202, "price": 400 }
        ]
    }
]

Discounts and VAT

Then, on each line:

  1. A discount is subtracted: discount_percent or discount_amount on the product, or else the discount from a campaign_code. They don't add up: a discount on the product replaces the campaign's discount on that line. Anything paid with a voucher_code is subtracted from what is left.
  2. VAT is added by FrontCore, at the VAT rate set on the product in FrontCore. So every price above, whether you send it or it comes from FrontCore, is a price before VAT. The order's totals show the amount both without and with VAT.

All amounts are in the booking's currency.

Example: you send "price": 1000 on the participant, and a campaign code gives 10% off. The course product has 25% VAT. The line is 1000 − 100 = 900 before VAT, and 900 + 225 = 1125 with VAT.

{
    "coursedate_id": 12761394,
    "payment_method": "invoice",
    "campaign_code": "SUMMER10",
    "participants": [
        { "firstname": "John", "lastname": "Doe", "email": "john@example.com", "price": 1000 }
    ]
}

Showing the price before the customer books

You can do this in two ways.

1. Ask FrontCore for the price of the whole booking. Send the booking request with "quote": true in config (and use_price_engine if you want the price engine's prices). Nothing is booked:

{
    "coursedate_id": 12761394,
    "payment_method": "invoice",
    "config": { "quote": true, "use_price_engine": true },
    "participants": [
        { "firstname": "John", "lastname": "Doe", "email": "john@example.com" }
    ]
}

The response shows each participant's lines and the totals with and without VAT. Here an early-bird rule gives 10% off a course priced at 6000, with 25% VAT:

{
    "successful": true,
    "quote": {
        "currency": "nok",
        "total_before_discounts": 5400,
        "total_calculated_discounts": 0,
        "total_after_discounts_excl_vat": 5400,
        "total_vat": 1350,
        "total_after_discounts_incl_vat": 6750,
        "total_spent_from_voucher": 0,
        "campaign": null,
        "voucher": null,
        "participants": [
            [
                {
                    "product_id": 101,
                    "title": "Course fee",
                    "price": 5400,
                    "discount": 0,
                    "total_excl_vat": 5400,
                    "total_incl_vat": 6750,
                    "price_engine": {
                        "original_price": 6000,
                        "price_label": "Early bird",
                        "rule_id": 12,
                        "rateplan_id": null,
                        "campaign_allowed": false
                    }
                }
            ]
        ]
    }
}

When the customer confirms, send the same request without quote. price_engine is null on lines the price engine didn't price. When the price engine couldn't calculate a price, it is { "error": "..." } and the line has the product's own price.

2. Get the course's price and send it yourself. Call GET /v2/price-quote?coursedate_id=12761394 and show final_price (before VAT) to the customer:

{
    "prices": [
        {
            "course_id": 9,
            "coursedate_id": 12761394,
            "final_price": 5400,
            "original_price": 6000,
            "price_label": "Early bird",
            "currency": "NOK",
            ...
        }
    ]
}

Then send it as price on the participant when booking. FrontCore charges exactly that price:

"participants": [
    { "firstname": "John", "lastname": "Doe", "email": "john@example.com", "price": 5400 }
]

Prices from the price engine can change over time, for example when an early-bird rule ends. A price you fetched earlier and send yourself is kept; with use_price_engine the booking gets the price at the moment it is made.

Response

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_details": {
            "payment_type": "card",
            "requires_redirect": true,
            "payment_session_id": "61303e7d-55b6-4a3e-8995-5c679c0138b1",
            "redirect_url": "https://somepaymentprovider.com/creditcard/payments/authorize/440996e71a469eb69c544218e5a933d29dcff1088d36ba68b76251df126d2dc7"
          }
    }
}

Unsuccessful response sample:

{
    "successful": false,
    "errors": [
       {
        "code" => some_error_code,
        "message" => "A human readable error response"
       }
    ]
}      



Examples


Example

{
    "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
    }
}

Minimal example

{
    "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
    }
}



Error codes

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.
course_date_cancelled The course date has been cancelled. Booking is not allowed on cancelled course dates.
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
© 2026 FrontCore