Documentation for version v75
Preliminary Order Calculation (Preorder)
Description
The preorder method performs a preliminary order calculation considering promotions and loyalty program participant points.
The request result can be used to display final amounts, discounts, and redemptions before creating the final order.
tip
This method does not create an order in the system; it returns the calculated order state with applied market and loyalty rules. To create the calculated order after a successful preorder, use the preorder_commit method.
URL
Method: POST
https://example.com/api/v1.1/market/orders/preorder
Request Parameters
| Parameter | Type | Example | Required | Description |
|---|---|---|---|---|
| token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
| external_id | string | "12" | Yes | External order ID |
| matching | string | "email" | Yes | Method for finding the loyalty program participant's profile. |
| string | "example@example.com" | If matching = email | Participant's email | |
| phone | string | "+79000000000" | If matching = phone | Participant's phone number |
| profile_id | string | "696e304f547840a7286619e0" | If matching = profile_id | Profile ID |
| data | JSON object | { | Yes | The |
tip
The lines field is required and must contain at least one order item.
Required Fields in data Object
| Parameter | Type | Example | Description |
|---|---|---|---|
| endpoint | string | "site" | Touchpoint (order source). Must be configured in the Market. |
| status | string | "new" | Order status. |
| currency | string | "RUB" | Order currency (three-letter ISO code). |
| total_price | string | "139999.00" | Total order cost. |
| lines | array | See below | The lines array contains information about order items. Minimum 1 element. |
Required Fields in Order Lines Object
| Parameter | Type | Example | Description |
|---|---|---|---|
| external_id | string | "line_1" | External line ID. |
| product or sku | string | "iphone17pmb256" | Product ID or SKU ID (one is required). |
| base_price_per_item | string | "139999.00" | Base price per item. |
| count | integer | 1 | Quantity of the item. |
Request Example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"external_id": "12",
"matching": "email",
"email": "example@example.com",
"data": {
"endpoint": "site",
"status": "new",
"delivery_cost": "0.00",
"total_price": "139999.00",
"currency": "RUB",
"redeem_points": [
{
"points_currency_iid": 1,
"amount": 499
}
],
"lines": [
{
"external_id": "line___ASTGRf",
"product": "iphone17pmb256",
"base_price_per_item": "139999.00",
"min_price_per_item": "0.00",
"final_price_per_item": "139999.00",
"count": 1,
"custom_fields": {},
"currency": "RUB"
}
]
}
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<external_id>12</external_id>
<matching>email</matching>
<email>example@example.com</email>
<data>
<endpoint>site</endpoint>
<status>new</status>
<delivery_cost>0.00</delivery_cost>
<total_price>139999.00</total_price>
<currency>RUB</currency>
<redeem_points>
<points_currency_iid>1</points_currency_iid>
<amount>499</amount>
</redeem_points>
<lines>
<external_id>line___ASTGRf</external_id>
<product>iphone17pmb256</product>
<base_price_per_item>139999.00</base_price_per_item>
<min_price_per_item>0.00</min_price_per_item>
<final_price_per_item>139999.00</final_price_per_item>
<count>1</count>
<currency>RUB</currency>
</lines>
</data>
</xml>
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| data | object | Data resulting from the calculation |
| error | int | Error code |
| error_text | string | Error text |
data Object
| Parameter | Type | Description |
|---|---|---|
| profile | object | Participant profile. Contains the profile ID. |
| order | object | Calculated order. More details |
Response Example
- JSON
- XML
{
"data": {
"profile": {
"profile_id": "696e304f547840a7286619e0"
},
"order": {
"processing_target": "calculated",
"total_price": "139999.00",
"final_total_price": "139500.00",
"delivery_cost": "0.00",
"currency": "RUB",
"lines": [
{
"external_id": "line___ASTGRf",
"line_number": 0,
"count": 1,
"product": "iphone17pmb256",
"base_price_per_item": "139999.00",
"min_price_per_item": "0.00",
"final_price_per_item": "139500.00",
"custom_fields": {},
"applied_promotions": [
{
"type": "accrue_points",
"promotion": {
"external_id": "bonus",
"name": "Accrue Points"
},
"points_info": {
"points_currency_iid": 1,
"points_currency_eid": "bonus1",
"name": "Main Point",
"amount": "6999"
}
},
{
"type": "redeem_points",
"promotion": {
"external_id": "bonus",
"name": "Redeem Points"
},
"points_info": {
"points_currency_iid": 1,
"points_currency_eid": "bonus1",
"name": "Main Point",
"amount": "499"
}
}
]
}
],
"custom_fields": {},
"applied_promotions": [],
"points_info": [
{
"points_currency_iid": 1,
"points_currency_eid": "bonus1",
"name": "Main Point",
"status": "success",
"active_amount_for_current_order": "20999",
"accrue_points_amount_for_current_order": "6999",
"redeemed_points_amount_for_current_order": "499"
}
],
"promocodes_info": []
}
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<profile>
<profile_id>696e304f547840a7286619e0</profile_id>
</profile>
<order>
<processing_target>calculated</processing_target>
<total_price>139999.00</total_price>
<final_total_price>139500.00</final_total_price>
<delivery_cost>0.00</delivery_cost>
<currency>RUB</currency>
<lines>
<external_id>line___ASTGRf</external_id>
<line_number>0</line_number>
<count>1</count>
<product>iphone17pmb256</product>
<base_price_per_item>139999.00</base_price_per_item>
<min_price_per_item>0.00</min_price_per_item>
<final_price_per_item>139500.00</final_price_per_item>
<custom_fields/>
<applied_promotions>
<type>accrue_points</type>
<promotion>
<external_id>bonus</external_id>
<name>Accrue Points</name>
</promotion>
<points_info>
<points_currency_iid>1</points_currency_iid>
<points_currency_eid>bonus1</points_currency_eid>
<name>Main Point</name>
<amount>6999</amount>
</points_info>
</applied_promotions>
<applied_promotions>
<type>redeem_points</type>
<promotion>
<external_id>bonus</external_id>
<name>Redeem Points</name>
</promotion>
<points_info>
<points_currency_iid>1</points_currency_iid>
<points_currency_eid>bonus1</points_currency_eid>
<name>Main Point</name>
<amount>499</amount>
</points_info>
</applied_promotions>
</lines>
<custom_fields/>
<applied_promotions/>
<points_info>
<points_currency_iid>1</points_currency_iid>
<points_currency_eid>bonus1</points_currency_eid>
<name>Main Point</name>
<status>success</status>
<active_amount_for_current_order>20999</active_amount_for_current_order>
<accrue_points_amount_for_current_order>6999</accrue_points_amount_for_current_order>
<redeemed_points_amount_for_current_order>499</redeemed_points_amount_for_current_order>
</points_info>
<promocodes_info/>
</order>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>