Create order request

Webpage graphic

Purpose

To allow a Glassboxx Vendor website to pass details of customer’s purchases of ebooks and audiobooks to Glassboxx.

For order lines that are discounted on the vendor website, as well as the price of the order line item, the discount amount must be passed in the discount_amount parameter of the request.

Multiple order lines for the same customer order can be passed in a single request.

As the Vendor website has handled the purchase transaction with the end customer, the order confirmation page and order confirmation email on the Vendor website should give the end customer details of how their purchases can be accessed. Glassboxx does not send an order confirmation email for orders received via the createOrder endpoint. For an example of the details to give the end customer, please make a purchase on our demo website here.

Pre-requisites

Token generated from token authentication request with token value included as Bearer in request header.

Request

base URL + endpoint /glassboxxorder/createOrder
Method POST

Parameters

An items JSON array consisting of the following elements:-

Name Type Mandatory Description
currency_code string TRUE ISO 3 character currency code, eg. GBP for Pounds Stirling
sku string TRUE ISBN13/sku of product purchased
created_at string TRUE Date when order is created in format CCYY-MM-DD, eg 2025-02-03
discount_amount string TRUE Amount of discount(s) included in order line value, as xxx.yy or 0 if no discounts applied. (The value passed should contain the amount only, no currency symbol.)
original_order_number string TRUE Order (transaction) number from Vendor’s site
email string TRUE The customer’s email address
first_name string TRUE The customer’s first name (not used)
last_name string TRUE The customer’s last name (not used)
vendor_id string TRUE The Vendor ID of the Glassboxx account (from the INTEGRATIONS / Vendor page in the Glassboxx Vendor Portal).
price_incl_tax string TRUE The product price (order line value) including tax, but before any discounts applied, as xxx.yy If a free book is being given to the customer, the price_incl_tax should be the price excluding discount, and the discount_amount passed should be equal to the price_incl_tax. (The value passed should contain the amount only, no currency symbol.)
duration_for_loan string TRUE The duration of the loan in days (if applicable – loans not in phase 1). (For a purchase transaction, a value of 0 or null should be passed.)
type_of_interaction string TRUE purchase | loan (‘loan’ not used in phase 1)
source string TRUE website (for requests sent from a 3rd party website)

Responses

Responses Status/Message Purpose/Reason/Resolution
200 (OK) Status SUCCESS
Message [blank]
Indicates the order line(s) was successfully passed to Glassboxx
200 (OK) Status ERROR
Message ‘SKU 126-9781849946650A not found on Glassboxx’
Indicates the order was not successfully created in Glassboxx, and giving the reason why.
400 (Bad request) Message: “%fieldName is a required field.”,parameters: {fieldName: “customer” The array has not been passed correctly to the endpoint
400 (Bad request) Message ‘Specified request cannot be processed.’ Please check the layout of the full request being passed.
401 (Unauthorized) You did not sign in correctly or your account is temporarily disabled Authentication token not supplied or not valid
500 (Internal Server Error) Message ‘Internal Error. Details are available in Magento log file. Report ID: webapi-xxxxxxxxxxxxxxx’ Normally means a parameter name has been incorrectly passed in the request
503 (Service Unavailable) You did not sign in correctly or your account is temporarily disabled Glassboxx Server not available due to maintenance.

Examples

1. Example request
https://server.glassboxx.co.uk/rest/V1/glassboxxorder/createOrder
with JSON body parameters:-

{
"items": [{
"currency_code":"AUD",
"sku":"9781849946650",
"created_at":"2024-10-14",
"discount_amount":"0",
"original_order_number":"pm2000004260",
"email":"postmantest6@mailinator.com",
"first_name":"pm6",
"last_name":"pm6",
"vendor_id":"126",
"price_incl_tax":"120",
"duration_for_loan":null,
"type_of_interaction":"purchase",
"source":"website",
"expiry_date":"2024-12-14",
"print_pages_limit":null,
"print_pages_pct":null,
"copy_limit":null,
"copy_limit_pct":null
}]
}

2. Example success response

{
    "status": "SUCCESS",
    "message": ""
}

2. Example error response

{
    "status": "ERROR",
    "message": "SKU 126-9781849946650A not found on Glassboxx"
}

3. Example request with multiple order lines passed in a single request:-
https://server.glassboxx.co.uk/rest/V1/glassboxxorder/createOrder
with JSON body parameters:-

{
"items":[{
"currency_code":"GBP",
"sku":"9781788700092",
"discount_amount":"0",
"original_order_number":"123456789",
"email":"test10@example.com",
"first_name":"Testf10",
"last_name":"Test10l",
"price_incl_tax":"6.99",
"duration_for_loan":"0",
"created_at":"2019-02-12 20:12:34",
"source":"website",
"vendor_id":"20",
"type_of_interaction":"purchase"
},
{
"currency_code":"GBP",
"sku":"9781788700123",
"discount_amount":"0",
"original_order_number":"123456789",
"email":"test10@example.com",
"first_name":"Testf10",
"last_name":"Test10l",
"price_incl_tax":"6.99",
"duration_for_loan":"0",
"created_at":"2019-02-12 20:12:34",
"source":"website",
"vendor_id":"20",
"type_of_interaction":"purchase"
}
]}