draft.items
aid_draft_orders_id_items_post
Updates a draft with new item
scopes:
- admin:shopping
- write:shopping
post/accounts/{aid}/shopping/draft_orders/{id}/items
Path parameters
aidstring ^[PT]{1}\d{8}$ required
An id that uniquely identifies the account.
idstring uuid required
The resource identifier string
Query parameters
apply_discountsboolean
Calculate available discounts and apply them to the order.
Requires additional scope for accessing the DealEngine, one of
- admin:discounts
- write:discounts
- write:discounts:/available_for_receipt
The tax_lines will be updated if apply_discount results in new net_amount.
- net_amount = gross_amount - Σ discount_lines.amount
tax_line.amount will be calculated from tax_line.percentage and net_amount.
Request body
Example request
{
"id": "175938",
"groups": [
{
"id": "B234",
"name": "Stol"
},
{
"id": "B1",
"name": "Møbel"
}
],
"line_id": 1,
"quantity": 2,
"gross_amount": 39800,
"net_amount": 27840,
"tax_lines": [
{
"amount": 5584,
"amount_dwh": "5584.0440",
"included_in_price": true,
"percentage": 25,
"tax_basis": 27920,
"tax_basis_dwh": "27920.22",
"tax_code": "3",
"tax_group": "Vmva-høy"
}
],
"description": "Stablestol for utendørsbruk",
"description_alias": "Staplestol",
"eligible_for_discount": true,
"discount_lines": [
{
"amount": 4400,
"percentage": 44,
"discount_id": "766da0ef-9283-42bd-b012-0582344ec53c",
"line_id": 1
}
],
"additions": [
{
"id": "C1203",
"description": "Extra Cheese",
"gross_amount": 27840,
"groups": [
{
"id": "B234",
"name": "Stol"
},
{
"id": "B1",
"name": "Møbel"
}
]
}
],
"store": {
"id": "SL02",
"organization_number": "123456789MVA",
"name": "SC Oslo",
"business_name": "SC Oslo AS"
},
"external_id": "SL02-94821948",
"payout": {
"destinations": [
{
"type": "percentage",
"value": "10",
"amount": 4000,
"destinations": [
{
"amount": 500
},
{
"destinations": [
{
"amount": 3500
}
]
}
]
},
{
"amount": 500
},
{
"destinations": [
{
"amount": 192
},
{
"amount": 38308
}
]
}
]
},
"original_currency": "SEK",
"original_gross_amount": 39800,
"conversion_rate_ppm": 1099000,
"conversion_rate_source": "ecb"
}Response
draft order was updated
Example response
{
"id": "bd04c959-d159-49b4-a096-2d84e014a8da",
"created_by": "bd04c959-d159-49b4-a096-2d84e014a8da",
"deleted_by": "bd04c959-d159-49b4-a096-2d84e014a8da",
"events": [
{
"id": "bd04c959-d159-49b4-a096-2d84e014a8da",
"created_by": "bd04c959-d159-49b4-a096-2d84e014a8da"
}
],
"options": {
"order_time_to_live": 94672800,
"payout": {
"rules": [
{
"rule_type": "order.items.store.id",
"rule_id": "sc029",
"rule_version": 1,
"destinations": [
{
"type": "percentage",
"value": 10,
"destinations": [
{
"type": "flat_amount",
"value": "500",
"destination": "account-a"
},
{
"type": "remaining_amount",
"destinations": [
{
"type": "percentage",
"value": "5.0",
"destination": "account-b"
}
]
}
]
},
{
"type": "flat_amount",
"value": "500",
"destination": "account-a"
},
{
"type": "remaining_amount",
"destinations": [
{
"type": "percentage",
"value": "5",
"destination": "account-b"
},
{
"type": "percentage",
"value": "95.0",
"destination": "account-c"
}
]
}
]
}
]
}
},
"order": {
"customer": {
"metadata": {
"dob_year": 1985
},
"created_by": "1c92f7e1-2897-4d46-bdcc-c127a914fb4e",
"deleted_by": "1c92f7e1-2897-4d46-bdcc-c127a914fb4e",
"first_name": "John",
"last_name": "Doe",
"email": "customer@example.com",
"phone_number": "+4799999999",
"enrolled_by": {
"type": "url",
"value": "https://facebook.com"
},
"marketing_consent": {
"sms": {
"consent": true,
"updated_at": "2018-01-12T13:42:00Z"
},
"email": {
"consent": true,
"updated_at": "2018-01-12T13:42:00Z"
}
},
"addresses": [
{
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO",
"latitude": 59.942112,
"longitude": 10.716991,
"comment": "5th floor, use doorbell."
}
],
"company": {
"organization_number": "123456789MVA",
"bussiness_name": "TKP tech AS",
"department": "sales department",
"industry": "computer industry"
},
"gender": "male",
"date_of_birth": "1990-09-20"
},
"gross_amount": 39800,
"net_amount": 27840,
"total_discount": 23130,
"shipping_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO",
"first_name": "John",
"last_name": "Doe",
"comment": "5th floor, use doorbell."
},
"billing_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO",
"first_name": "John",
"last_name": "Doe",
"comment": "5th floor, use doorbell."
},
"time_to_live": 94672800,
"itinerary": [
{
"arrival_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"latitude": 59.942112,
"longitude": 10.716991,
"country": "NO"
},
"departure_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"latitude": 59.942112,
"longitude": 10.716991,
"country": "NO"
}
}
],
"items": [
{
"id": "175938",
"groups": [
{
"id": "B234",
"name": "Stol"
},
{
"id": "B1",
"name": "Møbel"
}
],
"line_id": 1,
"quantity": 2,
"gross_amount": 39800,
"net_amount": 27840,
"tax_lines": [
{
"amount": 5584,
"amount_dwh": "5584.0440",
"included_in_price": true,
"percentage": 25,
"tax_basis": 27920,
"tax_basis_dwh": "27920.22",
"tax_code": "3",
"tax_group": "Vmva-høy"
}
],
"description": "Stablestol for utendørsbruk",
"description_alias": "Staplestol",
"eligible_for_discount": true,
"discount_lines": [
{
"amount": 4400,
"percentage": 44,
"discount_id": "766da0ef-9283-42bd-b012-0582344ec53c",
"line_id": 1
}
],
"additions": [
{
"id": "C1203",
"description": "Extra Cheese",
"gross_amount": 27840,
"groups": [
{
"id": "B234",
"name": "Stol"
},
{
"id": "B1",
"name": "Møbel"
}
]
}
],
"store": {
"id": "SL02",
"organization_number": "123456789MVA",
"name": "SC Oslo",
"business_name": "SC Oslo AS"
},
"external_id": "SL02-94821948",
"payout": {
"destinations": [
{
"type": "percentage",
"value": "10",
"amount": 4000,
"destinations": [
{
"amount": 500
},
{
"destinations": [
{
"amount": 3500
}
]
}
]
},
{
"amount": 500
},
{
"destinations": [
{
"amount": 192
},
{
"amount": 38308
}
]
}
]
},
"original_currency": "SEK",
"original_gross_amount": 39800,
"conversion_rate_ppm": 1099000,
"conversion_rate_source": "ecb"
}
],
"type": "delivery",
"order_number": "order123456",
"currency": "NOK",
"store": {
"id": "SL02",
"organization_number": "123456789MVA",
"name": "SC Oslo",
"business_name": "SC Oslo AS"
},
"external_links": [
{
"text": "Order Receipt",
"href": "https://example.dintero.com/receipts/234CC019-8BA9-4DDB-9A40-8C9EE0BB943C?type=pdf"
}
],
"attachments": [
{
"bus_reservation": {
"booking_id": "NE 138 47794",
"itinerary": [
{
"departure_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"arrival_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"operator": "SAS"
}
]
},
"car_reservation": {
"booking_id": "TV 347794",
"itinerary": [
{
"rental_company": "Avis",
"pick_up_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"drop_off_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
}
}
]
},
"ferry_reservation": {
"booking_id": "NE 138 47794",
"itinerary": [
{
"departure_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"arrival_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"operator": "SAS"
}
]
},
"metro_reservation": {
"booking_id": "NE 138 47794",
"itinerary": [
{
"departure_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"arrival_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"operator": "SAS"
}
]
},
"taxi_reservation": {
"booking_id": "NE 138 47794",
"itinerary": [
{
"departure_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"arrival_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"operator": "SAS"
}
]
},
"train_reservation": {
"booking_id": "NE 138 47794",
"itinerary": [
{
"departure_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"arrival_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"operator": "SAS"
}
]
},
"tram_reservation": {
"booking_id": "NE 138 47794",
"itinerary": [
{
"departure_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"arrival_address": {
"address_line": "Sommerkroveien 34",
"address_line_2": "PB 123",
"postal_code": "0349",
"postal_place": "Oslo",
"country": "NO"
},
"operator": "SAS"
}
]
}
}
],
"stores": [
{
"id": "SL02",
"organization_number": "123456789MVA",
"name": "SC Oslo",
"business_name": "SC Oslo AS"
}
]
}
}