Shopping API (v0)
Download OpenAPI specification:Download
Create cart
Creates a new cart. Use this method to create an order, or to create a return.
Its state is automatically set to draft
.
If you have enabled the mixed cart feature,
you should set the fulfillment_group
property for each product of the cart. It defines whether the product is to be shipped or picked up in store.
To update the content of the cart, use the Update cart method.
Authorizations:
Request Body schema: application/json
(Array of objects or objects) or (any or null) Describes returned items if any. | |
state | string (Order state) Enum: "draft" "ready" "placed" "accepted" "failed" Desired state of the order. Use 'draft' while patching the order, use 'placed' to make an attempt to place the order. |
shop | string or null <= 128 characters The shop containing the items of the order. |
shop_locale | string or null <= 128 characters The locale used for the shop, in RFC 5646. |
(any or null) or object Personal information about the customer. | |
tax_exempt | boolean Default: false If true, the order is tax exempt. |
object or (any or null) Billing address. If not set, the shipping address will be used. | |
store_id | string <= 256 characters ID of the store where this order was placed. |
object or (any or null) Manual order level price adjustments and coupons. | |
(any or null) or Array of objects Attributes set by the tenant to be carried over to the export APIs without affecting the business logic of the NewStore platform. | |
(any or null) or object Information about the source of the order. | |
(any or null) or Array of objects The list of products contained in the order. | |
payments | object Payment data blocks, each has the identifier provided as the key. The identifier depends on the 'type' property of the payment. When type is 'token', use the payment token. When type is 'authorized', use the charge identifier. When type is 'captured', use the capture identifier. Payments can be modified by these identifiers. Payment statuses are reported per identifier. |
object or (any or null) Shipping address. | |
object or (any or null) Describes if the order needs an approval, before it is placed. | |
associate_id | string or null <= 256 characters ID of the store associate who processed this order. |
string or (any or null) The currency for all the prices contained within this payload. |
Responses
Request samples
- Payload
{- "returns": [
- {
- "order_id": "string",
- "item_id": "string",
- "return_reason": "string",
- "refund": {
- "amount": 0,
- "metadata": { },
- "available_methods": [
- "string"
], - "method": "string"
}, - "blind_return": {
- "product_id": "string",
- "external_order_id": "string",
- "adjusted_item_price": 0,
- "pricebook": "string",
- "extended_attributes": [
- {
- "name": "string",
- "value": "string"
}
], - "calculated_price": {
- "item_price": 0,
- "item_list_price": 0,
- "item_tax_base": 0,
- "item_tax": 0,
- "item_gross": 0,
- "item_discount": 0,
- "item_order_discount": 0,
- "item_discount_info": [
- {
- "discount_ref": "string",
- "coupon_code": "string",
- "description": "string",
- "type": "fixed",
- "scope": "order",
- "original_value": 0,
- "price_adjustment": 0,
- "discount_source": "automatic"
}
], - "item_order_discount_info": [
- {
- "discount_ref": "string",
- "coupon_code": "string",
- "description": "string",
- "type": "fixed",
- "scope": "order",
- "original_value": 0,
- "price_adjustment": 0,
- "discount_source": "automatic"
}
], - "gift_wrapping_price": 0,
- "gift_wrapping_tax": 0
}, - "external_identifier": { }
}, - "was_blind": true,
- "return_code": 0,
- "item_condition": "string",
- "condition_code": 0
}
], - "state": "draft",
- "shop": "string",
- "shop_locale": "string",
- "customer": { },
- "tax_exempt": false,
- "billing_address": {
- "title": "string",
- "suffix": "string",
- "salutation": "string",
- "first_name": "string",
- "last_name": "string",
- "country": "st",
- "zip_code": "string",
- "city": "string",
- "state": "string",
- "address_line_1": "string",
- "address_line_2": "string",
- "phone": "string"
}, - "store_id": "string",
- "price_modifiers": {
- "manual_price_modifier": { },
- "coupons": [
- {
- "code": "string"
}
]
}, - "extended_attributes": { },
- "channel": { },
- "products": { },
- "payments": { },
- "shipping_address": {
- "title": "string",
- "suffix": "string",
- "salutation": "string",
- "first_name": "string",
- "last_name": "string",
- "country": "st",
- "zip_code": "string",
- "city": "string",
- "state": "string",
- "address_line_1": "string",
- "address_line_2": "string",
- "phone": "string"
}, - "manager_approval": {
- "approved_by": "string",
- "approved_rules": [
- "string"
], - "matched_rules": [
- {
- "label": "string",
- "description": "string",
- "restricted_payment_methods": [
- "cash"
]
}
]
}, - "associate_id": "string",
- "currency": "string"
}
Response samples
- 200
- 400
{- "schema": {
- "associate_id": "7b08ff9a82c9488e905003fce9ad0a53",
- "billing_address": {
- "address_line_1": "1 United Nations Plaza",
- "city": "New York",
- "country": "US",
- "first_name": "John",
- "last_name": "Doe",
- "phone": "7036917165",
- "state": "NY",
- "zip_code": "10017"
}, - "channel": {
- "name": "NewStore Associate App",
- "type": "web"
}, - "currency": "USD",
- "customer": {
- "email": "johndoe@example.com",
- "id": "f4251bc6-2871-419c-84d0-c9ea40785fa2",
- "language": "EN",
- "name": "John Doe"
}, - "discounts": null,
- "id": "569ac9d0-9d69-429c-b263-fe7482561a25",
- "messages": null,
- "payment_statuses": { },
- "price_modifiers": { },
- "products": [
- {
- "calculated_price": {
- "gift_wrapping_price": 0,
- "gift_wrapping_tax": 0,
- "item_discount": 0,
- "item_discount_info": null,
- "item_gross": 15,
- "item_list_price": 13.78,
- "item_order_discount": 0,
- "item_price": 13.78,
- "item_tax": 1.22,
- "item_tax_base": 13.78,
- "item_tax_details": [
- {
- "Amount": 0.55,
- "Name": "NY STATE TAX",
- "Rate": 0.04
}, - {
- "Amount": 0.62,
- "Name": "NY CITY TAX",
- "Rate": 0.045
}
]
}, - "extended_attributes": [
- {
- "name": "item-level",
- "value": "attribute"
}
], - "external_identifiers": [
- {
- "ean13": "2900010000114",
- "sku": "1000011"
}
], - "fulfillment_group": {
- "type": "IN_STORE_HANDOVER"
}, - "group_id": "",
- "item_ids": [
- "0332684e-73f6-47f8-83b9-0d3948d33b77"
], - "pricebook": "",
- "product_id": "1000011",
- "quantity": 1
}, - {
- "calculated_price": {
- "gift_wrapping_price": 0,
- "gift_wrapping_tax": 0,
- "item_discount": 0,
- "item_discount_info": null,
- "item_gross": 15,
- "item_list_price": 13.78,
- "item_order_discount": 0,
- "item_order_discount_info": null,
- "item_price": 13.78,
- "item_tax": 1.22,
- "item_tax_base": 13.78,
- "item_tax_details": [
- {
- "Amount": 0.55,
- "Name": "NY STATE TAX",
- "Rate": 0.04
}, - {
- "Amount": 0.62,
- "Name": "NY CITY TAX",
- "Rate": 0.045
}, - {
- "Amount": 0.05,
- "Name": "NY SPECIAL TAX",
- "Rate": 0.00375
}
]
}, - "extended_attributes": [
- {
- "name": "item-level",
- "value": "attribute"
}
], - "external_identifiers": [
- {
- "ean13": "2900010000114",
- "sku": "1000011"
}
], - "fulfillment_group": {
- "type": "SHIPPING"
}, - "group_id": "",
- "item_ids": [
- "40a3dc40-56cf-415e-b9a3-9d2a1f3a1791"
], - "pricebook": "",
- "product_id": "1000011",
- "quantity": 1
}
], - "remaining_amount": 30,
- "shipping_address": {
- "address_line_1": "1 United Nations Plaza",
- "city": "New York",
- "country": "US",
- "first_name": "John",
- "last_name": "Doe",
- "phone": "7036917165",
- "state": "NY",
- "zip_code": "10017"
}, - "shipping_solution_id": "",
- "shop": "storefront-catalog-en",
- "shop_locale": "en-US",
- "state": "draft",
- "store_id": "7c9f2605-9fb3-5444-8fee-47fe51608efe",
- "tax_exempt": false,
- "totals": {
- "discount_total": 0,
- "grand_total": 30,
- "price_method": "tax_excluded",
- "shipping_tax_amount": 0,
- "shipping_total": 0,
- "sub_total": 0,
- "subtotal": 27.56,
- "tax_strategy": "avalara",
- "tax_total": 2.44
}
}
}
Get cart by id
Retrieves the specified cart.
Authorizations:
path Parameters
id required | string^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}... UUID-like identifier for the cart. The id is returned when you call the Create cart method. |
Responses
Response samples
- 200
- 400
- 404
- 500
{- "id": "string",
- "messages": [
- "string"
], - "exchange": {
- "type": "string",
- "amount": 0
}, - "payment_statuses": { },
- "totals": {
- "price_method": "tax_included",
- "subtotal": 0,
- "shipping_total": 0,
- "shipping_tax_amount": 0,
- "discount_total": 0,
- "grand_total": 0,
- "tax_total": 0
}, - "remaining_amount": 0,
- "discounts": { },
- "return_status": {
- "status": "pending",
- "error": {
- "code": "string",
- "description": "string"
}
}, - "manager_approval": {
- "approved_by": "string",
- "approved_rules": [
- "string"
], - "matched_rules": [
- {
- "label": "string",
- "description": "string",
- "restricted_payment_methods": [
- "cash"
]
}
]
}, - "fiscal_cashbox_id": "string",
- "tax_exemption_class": "string",
- "tax_exemption_number": "string"
}
Update cart
Updates an existing cart. Use this method to update the status of the cart or to add items, payments, or a shipping method to the cart in order to place an order, return items or exchange items.
This method is also a way to ensure synchronization with the backend.
For example, if you request a state change from ready
to draft
, the backend will reject the state change if your order still matches all criteria to be ready.
Note: You can call this method with an empty body to get the status of the payment(s).
Limitations:
- An order can only contain one shipping address and one billing address.
- At most 100 items per order are allowed.
- At most 10 payments can be provided per order.
- At most 100 extended attributes can be provided per order.
- At most one discount coupon can be applied per order.
- At most one manual order-level adjustment can be applied per order.
- At most one manual item-level adjustment can be applied per item.
However, a coupon as well as a manual price adjustment can be applied together on the same order, even if both result in an order-level discount or an item-level discount (also if both discounts are applied on the same item). Related resources:
- Use the Orders resource to retrieve the identifiers of the order and items to return.
- Use the User configuration resource to retrieve the configured return reasons, item conditions, and their corresponding codes.
Authorizations:
path Parameters
id required | string^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}... UUID-like identifier for the cart. The id is returned when you call the Create cart method. |
Request Body schema: application/json
(Array of objects or objects) or (any or null) Describes returned items if any. | |
state | string (Order state) Enum: "draft" "ready" "placed" "accepted" "failed" Desired state of the order. Use 'draft' while patching the order, use 'placed' to make an attempt to place the order. |
shop | string or null <= 128 characters The shop containing the items of the order. |
shop_locale | string or null <= 128 characters The locale used for the shop, in RFC 5646. |
(any or null) or object Personal information about the customer. | |
tax_exempt | boolean Default: false If true, the order is tax exempt. |
object or (any or null) Billing address. If not set, the shipping address will be used. | |
store_id | string <= 256 characters ID of the store where this order was placed. |
object or (any or null) Manual order level price adjustments and coupons. | |
(any or null) or Array of objects Attributes set by the tenant to be carried over to the export APIs without affecting the business logic of the NewStore platform. | |
(any or null) or object Information about the source of the order. | |
(any or null) or Array of objects The list of products contained in the order. | |
payments | object Payment data blocks, each has the identifier provided as the key. The identifier depends on the 'type' property of the payment. When type is 'token', use the payment token. When type is 'authorized', use the charge identifier. When type is 'captured', use the capture identifier. Payments can be modified by these identifiers. Payment statuses are reported per identifier. |
object or (any or null) Shipping address. | |
object or (any or null) Describes if the order needs an approval, before it is placed. | |
associate_id | string or null <= 256 characters ID of the store associate who processed this order. |
string or (any or null) The currency for all the prices contained within this payload. | |
shipping_solution_id | string or null <= 64 characters Identifies shipping solution for the order. Can be 'in_store_handover' when no shipping is required or one of the identifiers returned by the /order/{id}/shipping_solutions endpoint. |
Responses
Request samples
- Payload
{- "returns": [
- {
- "order_id": "string",
- "item_id": "string",
- "return_reason": "string",
- "refund": {
- "amount": 0,
- "metadata": { },
- "available_methods": [
- "string"
], - "method": "string"
}, - "blind_return": {
- "product_id": "string",
- "external_order_id": "string",
- "adjusted_item_price": 0,
- "pricebook": "string",
- "extended_attributes": [
- {
- "name": "string",
- "value": "string"
}
], - "calculated_price": {
- "item_price": 0,
- "item_list_price": 0,
- "item_tax_base": 0,
- "item_tax": 0,
- "item_gross": 0,
- "item_discount": 0,
- "item_order_discount": 0,
- "item_discount_info": [
- {
- "discount_ref": "string",
- "coupon_code": "string",
- "description": "string",
- "type": "fixed",
- "scope": "order",
- "original_value": 0,
- "price_adjustment": 0,
- "discount_source": "automatic"
}
], - "item_order_discount_info": [
- {
- "discount_ref": "string",
- "coupon_code": "string",
- "description": "string",
- "type": "fixed",
- "scope": "order",
- "original_value": 0,
- "price_adjustment": 0,
- "discount_source": "automatic"
}
], - "gift_wrapping_price": 0,
- "gift_wrapping_tax": 0
}, - "external_identifier": { }
}, - "was_blind": true,
- "return_code": 0,
- "item_condition": "string",
- "condition_code": 0
}
], - "state": "draft",
- "shop": "string",
- "shop_locale": "string",
- "customer": { },
- "tax_exempt": false,
- "billing_address": {
- "title": "string",
- "suffix": "string",
- "salutation": "string",
- "first_name": "string",
- "last_name": "string",
- "country": "st",
- "zip_code": "string",
- "city": "string",
- "state": "string",
- "address_line_1": "string",
- "address_line_2": "string",
- "phone": "string"
}, - "store_id": "string",
- "price_modifiers": {
- "manual_price_modifier": { },
- "coupons": [
- {
- "code": "string"
}
]
}, - "extended_attributes": { },
- "channel": { },
- "products": { },
- "payments": { },
- "shipping_address": {
- "title": "string",
- "suffix": "string",
- "salutation": "string",
- "first_name": "string",
- "last_name": "string",
- "country": "st",
- "zip_code": "string",
- "city": "string",
- "state": "string",
- "address_line_1": "string",
- "address_line_2": "string",
- "phone": "string"
}, - "manager_approval": {
- "approved_by": "string",
- "approved_rules": [
- "string"
], - "matched_rules": [
- {
- "label": "string",
- "description": "string",
- "restricted_payment_methods": [
- "cash"
]
}
]
}, - "associate_id": "string",
- "currency": "string",
- "shipping_solution_id": "string"
}
Response samples
- 200
- 400
- 403
{- "id": "string",
- "messages": [
- "string"
], - "exchange": {
- "type": "string",
- "amount": 0
}, - "payment_statuses": { },
- "totals": {
- "price_method": "tax_included",
- "subtotal": 0,
- "shipping_total": 0,
- "shipping_tax_amount": 0,
- "discount_total": 0,
- "grand_total": 0,
- "tax_total": 0
}, - "remaining_amount": 0,
- "discounts": { },
- "return_status": {
- "status": "pending",
- "error": {
- "code": "string",
- "description": "string"
}
}, - "manager_approval": {
- "approved_by": "string",
- "approved_rules": [
- "string"
], - "matched_rules": [
- {
- "label": "string",
- "description": "string",
- "restricted_payment_methods": [
- "cash"
]
}
]
}, - "fiscal_cashbox_id": "string",
- "tax_exemption_class": "string",
- "tax_exemption_number": "string"
}
Generate cart token
Generates a cart token that can be exposed to external parties. A cart token is the encrypted order identifier. It can be exposed in public APIs when authentication is not an option but the order identifier is needed.
Authorizations:
path Parameters
id required | string^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}... UUID-like identifier for the cart. The id is returned when you call the Create cart method. |
Responses
Response samples
- 200
- 400
- 404
{- "schema": {
- "cart_token": "K3-E9C_gIOt2CGkvw0bTxvh2bz1Be78uqumw8dAw4B9fX2wYnCQeSWDeiF6twssryMmOYRoonPUUibFCZDejJw=="
}
}
Get shipping solutions
Generates shipping solutions for the order. If there are any shipping discounts on the order, they will be applied to the shipping solutions. Tax is not calculated on the shipping solution generation. The tax is only calculated when the shipping solution is added to the order.
Authorizations:
path Parameters
id required | string^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}... UUID-like identifier for the cart. The id is returned when you call the Create cart method. |
Responses
Response samples
- 200
- 400
{- "shipping_solutions": { }
}
Get document
Retrieves the document related to the provided cart id.
The type of document you get depends on the what the cart was used for:
- A cart used to place an order: you retrieve a sales receipt.
- A cart used for a return, you retrieve a refund note.
- A cart used to exchange some items, you retrieve an exchange receipt.
Authorizations:
path Parameters
id required | string^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}... UUID-like identifier for the cart. The id is returned when you call the Create cart method. |
Responses
Response samples
- 200
- 400
- 404
- 500
{- "schema": {
- "document_type": "sales_receipt"
}
}
Send document
Sends the document related to the provided cart id to the provided email address.
The type of document depends on the what the cart was used for:
- A cart used to place an order: a sales receipt is sent.
- A cart used for a return, a refund note is sent.
- A cart used to exchange some items, an exchange receipt is sent.
Authorizations:
path Parameters
id required | string^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}... UUID-like identifier for the cart. The id is returned when you call the Create cart method. |
Request Body schema: application/json
email required | string The email address the document is sent to. |
force_send | boolean If it is set to true, the email would be sent even if it was sent before. |
Responses
Request samples
- Payload
{- "schema": {
- "email": "customer@example.org"
}
}
Response samples
- 400
- 404
- 500
{- "schema": {
- "error_code": "bad_request",
- "message": "The provided request is invalid.",
- "request_id": "2018.10.18"
}
}