shop.order.save

Saves order data to datanase.

Parameters

  • id POST

    Order ID.

  • items POST

    Order items data array. Each items’s sub-array can contain the following values:
    - []['sku_id']: ID of the product variant to which an order item is related. Used for identifying order items when an order is being saved, in the case when the 'items'[]['item_id'] value is missing.
    - []['quantity']: ordered variant’s quantity in the decimal(15,3) format. If this value is not specified then 1 is set by default.
    - []['price']: ordered variant’s price, expressed in the order currency, in the decimal(15,4) format. If this value is not specified then the current variant price from the 'shop_product_skus' table is set by default in the case if the variant has not been deleted from the product catalog.
    - []['total_discount']: amount of discount applied for the entire quantity of a particular order item, expressed in the order currency, in the decimal(15,4) format.
    - []['stock_id']: ID of the stock from which ordered variant’s quantity must be withdrawn. If this value is not specified then one of the existing stock IDs is used by default.
    - []['virtual_stock_id']: ID of the virtual stock from which ordered variant’s quantity must be withdrawn. If this value is not specified then one of the existing virtual stock IDs is used by default.
    - []['services']: array of data related to the services associated with an ordered product variant.
    - []['services'][]['item_id']: ID of an order item representing a service. If an ID is specified then this method updates information about the corresponding service of a particular order item. If this value is empty, and values 'items'[]['services'][]['service_id'] and 'items'[]['services'][]['service_variant_id'], are specified, then either an existing service for the particular order item is updated or a new service with these values is added to that item. Services whose 'items'[]['services'][]['item_id'] values are missing in a POST request for the particular order item are removed by this method.
    - []['services'][]['price']: service cost, expressed in the order currency, in the decimal(15,4) format.
    - []['services'][]['total_discount']: discount applied to a service, expressed in the order currency, in the decimal(15,4) format.

  • customer POST Optional

    Customer data array.

  • shipping_address POST Optional

    Associative array of shipping address fields.

  • billing_address POST Optional

    Associative array of billing address fields.

  • discount POST Optional

    Discount information in one the following formats:
    - Discount amount in order currency.
    - null, if discount shold not be changed.
    - calculate, if discount must be re-calculated automatically.

  • params POST Optional

    Array of order parameters for shop_order_params table.

  • comment POST Optional

    Order comment.

  • contact_id POST

    Customer contact ID. An order will be linked to the specified customer only if there is currently no customer-related information in the order data; e.g., if an order was created using the shop.order.addInvoice method.

  • format GET Optional

    Sets response format. Available options: json (default), xml.

Error codes

  • invalid_request

    Invalid formed request. Additional information about the error is available in error_description parameter.

  • access_denied

    Access to the specified API method for the current token is denied.

  • invalid_method

    Unknown API method.