# 13. The create_order method¶

Given a “crypto_block” from the “discount_options” method, along with a set of discount tokens, this method produces an order object incorporating those discounts, which can then be added to a trolley for reservation and purchasing. For products where only a single blanket discount can be applied across the whole order then only a single discount token is required at the input, else a discount for each ticket must be present, one take from each of the lists of discounts returned by the “discount_option” method. The discounts do not need to be present in any particular order, and groups of the same discount do not need to be presented together. If discounts are not supported then only the “crypto_block” should be presented at the input, and no discount tokens at all.

## 13.1. Required inputs¶

The “crypto_block” from the “discount_options” method must be present. If discounts are not supported then this is all that is required. If a blanket discount is required then a single “discount_token” should be supplied, which will be applied across the whole order. Else a “discount_token” should be present for each ticket in the order, one from each of the discount lists, such that the total number of tokens equals the total number of tickets in the order.

### 13.1.1. Example input¶

<create_order>
<user_id>demo</user_id>
<crypto_block>U1--Nq2HPJSjr9CrdElqdlMo4566Y3uXgV5uorhh0OTj7Uema
MCdc_OdGkbgD7w8NVmr80hEB45iIGeO3wfRwnlU-9_kWJcvIXy3Q0oPq5qwP-85
WNAEBo4CfCn0u6dS8czfD1H-Oy0tLFeVCb6Aqgn41_5pJry1jlp8oGgcKXVtPtp
owaoG6ieefxBL12spf1RDgjtpjcqfykcYVZgeQrSiMiENVrdsHOVLDmh9TPSJyq
7qk2KQwEvabAOrs-vW9otaXdPAJMvE8MCUS60TYJ-hDInDdo5roes5i4UpGGzuq
yA-Z</crypto_block>
<discount_token>M_--IbGqi00j3ybOpqyoBkzpk7VaFCjbF7_8CJX4e5KsEPl
xYDjouGoFr30--Y</discount_token>
<discount_token>Q_--Ightfvxcj3ybOpqyoBkpk7VaFCjbF7_8CJX4e5KsEPl
xYDjouGoFr30--Y</discount_token>
</create_order>


## 13.2. Output data¶

The output simply consists of the fully discounted order contained in an “order_token” element. The “crypto_block” produced here only contains the authentication information and is equivalent to one generated from “start_session”. It can thus be used as the starting point for a new search, or else as the authentication input for any of the trolley handling methods.

### 13.2.1. Example output¶

<create_order_result>
YUZz_Kq23SaaVvPmF43Ndbq2o1t5Nq60tvNucAoeiun5eRalXx5Tz-H7Q7UreSD
lXCTGZEvwqddnGIUevnZY</crypto_block>
<order_token>E1--_mjRuXT_ko3XfykAhrLF2pU83_vWRy2eo2GoU9KOeM8D7b
UtQfbYDKQI5wjcXNkQTawn1t0Uky8dHP9v_uT5yWNr361OuYUEhOa3xJVCr7zMH
s58F-3to-nZ7djPUY085aJnq4PTKDRFizaLrId_Sy6HlIw76yy3KcJEHCAAydxf
SMrtV4Mx3uLcWGX5DUzFnXs4MId_FllMAqUksPTnn9npgn7LybccDxU0pai2HJ4
IwJ6rJkvmEeoreJIIHKrSeeQzfUY483T1upBF445xK_--Z</order_token>
</create_order_result>


## 13.3. Potential failure codes¶

• 1 - the supplied crypto block was not generated by
“discount_options”
• 2 - the requested “mime_text_type” was not a supported value
• 501 - a corrupt “discount_token” has been supplied
• 502 - discounts tokens supplied when the product order not
support discounts
• 503 - no discount tokens were supplied
• 504 - multiple discount tokens were supplied for an order which
requires a blanket discount
• 505 - the wrong number of discount tokens were supplied for the
order in question
• 506 - the number of different discount types provided exceeds the
allowed limit
• 507 - more than one discount token has been supplied from the
same “discounts” element