---
title: "Add product discount"

doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-rest-api/order/edit-order-combination-interface/add-product-discount'
  md: 'https://developer.shopline.com/docs/admin-rest-api/order/edit-order-combination-interface/add-product-discount.md'
---
# Add product discount

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **Required Scopes:** `write_orders`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
POST /orders/order_edit_add_line_item_discount.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` .

## Required Permissions

* `write_orders`

## Request

### Request Headers

* `Content-Type`

  string (required)

  The field must be set to the fixed value `application/json; charset=utf-8`.

* `Authorization`

  string (required)

   The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. 

### Request Body

* `request`

  object

  Request body

  * `discount`

    object

    Product discount

    * `description`

      string

      Discount description

    * `fixed_value`

      object

      The Discount value of the fixed amount supports two decimal points . when the discount is the fixed amount type , it cannot be empty at the same time as percent_value .

      * `amount`

        string

        Amount ( two precision double type strings )

      * `currency_code`

        string

        Currency

    * `percent_value`

      string

      Percentage Discount value , two decimal points between 0-1 , such as 0.2=20%off when the discount is the percentage type , and cannot be empty at the same time as fixed_value

  * `id`

    string

    Edit order draft order id , you can get it from call order editing-start interface return parameters

  * `line_item_id`

    string

    Product row id

## Response

### Status Codes

* `200`

  For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise.

### Response Body

#### 200

* `user_errors`

  array<object>

  Error prompt information of this editor , if there is an error in the execution , it will be return in this field , and the call can be tried again according to the error code ( note : try again and need to start the interface from the order_edit.json order editing to start the whole set of

  * `message`

    string

    Error message

  * `code`

    string

    The wrong code , if the implementation result is wrong , it will be return the wrong code through this field , and the call can be tried again according to the wrong code ( note : try again and need to start the interface from the order_edit.json order editing to start the whole set of editing order

  * `field`

    array<string>

    The path to the input field that caused the error. leads to the path of incorrect input fields

* `calculated_line_item`

  object

  Product information for this editor

  * `added_discount_staged_change`

    object

    Product line custom discount information

    * `percent_value`

      string

      Percentage Discount value , two decimal points between 0-1 , such as 0.2=20%off as the discount is the percentage type , this item is worth it

    * `description`

      string

      Discount description

    * `fixed_value`

      object

      The Discount value of the fixed amount supports two decimal points . the discount is the fixed amount type , which is worthwhile

      * `amount`

        string

        Amount , two precision double type strings

      * `currency_code`

        string

        Currency

    * `id`

      string

      Discount id

  * `id`

    string

    Order editing Product line id in draft order

  * `original_unit_price_set`

    object

    Original price , no application favorable price

    * `shop_money`

      object

      Store currency amount information

      * `amount`

        string

        Value of amount , 2- bit accuracy string

      * `currency_code`

        string

        Currency

    * `presentment_money`

      object

      Market currency amount information

      * `amount`

        string

        Value of amount , 2- bit accuracy string

      * `currency_code`

        string

        Currency

  * `quantity`

    string

    Quantity

  * `required_shipping`

    boolean

    Shipping or not

  * `taxable`

    boolean

    Tax or not required

  * `title`

    string

    Product title

  * `variant_id`

    string

    Product sku

* `calculated_order`

  object

  Edit order draft order information

  * `committed`

    boolean

    Have submitted save to order or not

  * `id`

    string

    Order editing draft order id


#### 401

* `errors`

  string

  Error message. 


#### 429

* `errors`

  string

  Error message. 


## OpenAPI Definition

```json
{
  "externalDocs": {
    "description": "Permission point used by the interface is `write_orders` , For more information about the use of permission points, see",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=en",
    "errorTableDescription": ""
  },
  "operationId": "PVIUEKVT",
  "parameters": [
    {
      "name": "Content-Type",
      "in": "header",
      "description": "The field must be set to the fixed value `application/json; charset=utf-8`.",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": " The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. ",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": " The access token for the API. Please refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then put the obtained access token into the API request header in Bearer Token.",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "request": {
              "name": "request",
              "description": "Request body",
              "type": "object",
              "properties": {
                "discount": {
                  "name": "discount",
                  "description": "Product discount",
                  "type": "object",
                  "properties": {
                    "description": {
                      "name": "description",
                      "description": "Discount description",
                      "type": "string",
                      "example": "Custom discount"
                    },
                    "fixed_value": {
                      "name": "fixed_value",
                      "description": "The Discount value of the fixed amount supports two decimal points . when the discount is the fixed amount type , it cannot be empty at the same time as percent_value .",
                      "type": "object",
                      "properties": {
                        "amount": {
                          "name": "amount",
                          "description": "Amount ( two precision double type strings )",
                          "type": "string",
                          "example": "2.0"
                        },
                        "currency_code": {
                          "name": "currency_code",
                          "description": "Currency",
                          "type": "string",
                          "example": "USD"
                        }
                      },
                      "example": {
                        "amount": "2.0",
                        "currency_code": "USD"
                      }
                    },
                    "percent_value": {
                      "name": "percent_value",
                      "description": "Percentage Discount value , two decimal points between 0-1 , such as 0.2=20%off when the discount is the percentage type , and cannot be empty at the same time as fixed_value",
                      "type": "string",
                      "example": "0"
                    }
                  },
                  "example": {
                    "description": "Custom discount",
                    "fixed_value": {
                      "currency_code": "USD",
                      "amount": "2.0"
                    },
                    "percent_value": "0"
                  }
                },
                "id": {
                  "name": "id",
                  "description": "Edit order draft order id , you can get it from call order editing-start interface return parameters",
                  "type": "string",
                  "example": "21098923432423423423"
                },
                "line_item_id": {
                  "name": "line_item_id",
                  "description": "Product row id",
                  "type": "string",
                  "example": "6070492982498829423"
                }
              },
              "required": [
                "discount",
                "id",
                "line_item_id"
              ],
              "example": {
                "id": "21098923432423423423",
                "line_item_id": "6070492982498829423",
                "discount": {
                  "description": "Custom discount",
                  "fixed_value": {
                    "amount": "2.0",
                    "currency_code": "USD"
                  },
                  "percent_value": "0"
                }
              }
            }
          },
          "required": [
            "request"
          ],
          "example": {
            "request": {
              "id": "21098923432423423423",
              "line_item_id": "6070492982498829423",
              "discount": {
                "fixed_value": {
                  "amount": "2.0",
                  "currency_code": "USD"
                },
                "percent_value": "0",
                "description": "Custom discount"
              }
            }
          }
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).",
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "user_errors": {
                "name": "user_errors",
                "description": "Error prompt information of this editor , if there is an error in the execution , it will be return in this field , and the call can be tried again according to the error code ( note : try again and need to start the interface from the order_edit.json order editing to start the whole set of",
                "type": "array",
                "items": {
                  "name": "user_errors",
                  "description": "Error prompt information of this editor , if there is an error in the execution , it will be return in this field , and the call can be tried again according to the error code ( note : try again and need to start the interface from the order_edit.json order editing to start the whole set of",
                  "type": "object",
                  "properties": {
                    "message": {
                      "name": "message",
                      "description": "Error message",
                      "type": "string",
                      "example": "unauthorized access"
                    },
                    "code": {
                      "name": "code",
                      "description": "The wrong code , if the implementation result is wrong , it will be return the wrong code through this field , and the call can be tried again according to the wrong code ( note : try again and need to start the interface from the order_edit.json order editing to start the whole set of editing order",
                      "type": "string",
                      "example": "UNAUTHORIZED_ACCESS"
                    },
                    "field": {
                      "name": "field",
                      "description": "The path to the input field that caused the error. leads to the path of incorrect input fields",
                      "type": "array",
                      "items": {
                        "name": "field",
                        "description": "The path to the input field that caused the error. leads to the path of incorrect input fields",
                        "type": "string",
                        "example": "[\"id\"]"
                      },
                      "example": [
                        "[\"id\"]"
                      ]
                    }
                  },
                  "example": {
                    "code": "UNAUTHORIZED_ACCESS",
                    "field": [
                      "[\"id\"]"
                    ],
                    "message": "unauthorized access"
                  }
                },
                "example": [
                  {
                    "code": "UNAUTHORIZED_ACCESS",
                    "field": [
                      "[\"id\"]"
                    ],
                    "message": "unauthorized access"
                  }
                ]
              },
              "calculated_line_item": {
                "name": "calculated_line_item",
                "description": "Product information for this editor",
                "type": "object",
                "properties": {
                  "added_discount_staged_change": {
                    "name": "added_discount_staged_change",
                    "description": "Product line custom discount information",
                    "type": "object",
                    "properties": {
                      "percent_value": {
                        "name": "percent_value",
                        "description": "Percentage Discount value , two decimal points between 0-1 , such as 0.2=20%off as the discount is the percentage type , this item is worth it",
                        "type": "string",
                        "example": "0"
                      },
                      "description": {
                        "name": "description",
                        "description": "Discount description",
                        "type": "string",
                        "example": "Custom discount"
                      },
                      "fixed_value": {
                        "name": "fixed_value",
                        "description": "The Discount value of the fixed amount supports two decimal points . the discount is the fixed amount type , which is worthwhile",
                        "type": "object",
                        "properties": {
                          "amount": {
                            "name": "amount",
                            "description": "Amount , two precision double type strings",
                            "type": "string",
                            "example": "2.0"
                          },
                          "currency_code": {
                            "name": "currency_code",
                            "description": "Currency",
                            "type": "string",
                            "example": "USD"
                          }
                        },
                        "example": {
                          "amount": "2.0",
                          "currency_code": "USD"
                        }
                      },
                      "id": {
                        "name": "id",
                        "description": "Discount id",
                        "type": "string",
                        "example": "6070492985350956144"
                      }
                    },
                    "example": {
                      "percent_value": "0",
                      "description": "Custom discount",
                      "fixed_value": {
                        "amount": "2.0",
                        "currency_code": "USD"
                      },
                      "id": "6070492985350956144"
                    }
                  },
                  "id": {
                    "name": "id",
                    "description": "Order editing Product line id in draft order",
                    "type": "string",
                    "example": "6070492982498829423"
                  },
                  "original_unit_price_set": {
                    "name": "original_unit_price_set",
                    "description": "Original price , no application favorable price",
                    "type": "object",
                    "properties": {
                      "shop_money": {
                        "name": "shop_money",
                        "description": "Store currency amount information",
                        "type": "object",
                        "properties": {
                          "amount": {
                            "name": "amount",
                            "description": "Value of amount , 2- bit accuracy string",
                            "type": "string",
                            "example": "20.0"
                          },
                          "currency_code": {
                            "name": "currency_code",
                            "description": "Currency",
                            "type": "string",
                            "example": "USD"
                          }
                        },
                        "example": {
                          "amount": "20.0",
                          "currency_code": "USD"
                        }
                      },
                      "presentment_money": {
                        "name": "presentment_money",
                        "description": "Market currency amount information",
                        "type": "object",
                        "properties": {
                          "amount": {
                            "name": "amount",
                            "description": "Value of amount , 2- bit accuracy string",
                            "type": "string",
                            "example": "20.0"
                          },
                          "currency_code": {
                            "name": "currency_code",
                            "description": "Currency",
                            "type": "string",
                            "example": "USD"
                          }
                        },
                        "example": {
                          "currency_code": "USD",
                          "amount": "20.0"
                        }
                      }
                    },
                    "example": {
                      "shop_money": {
                        "amount": "20.0",
                        "currency_code": "USD"
                      },
                      "presentment_money": {
                        "currency_code": "USD",
                        "amount": "20.0"
                      }
                    }
                  },
                  "quantity": {
                    "name": "quantity",
                    "description": "Quantity",
                    "type": "string",
                    "example": "1"
                  },
                  "required_shipping": {
                    "name": "required_shipping",
                    "description": "Shipping or not",
                    "type": "boolean",
                    "example": true
                  },
                  "taxable": {
                    "name": "taxable",
                    "description": "Tax or not required",
                    "type": "boolean",
                    "example": true
                  },
                  "title": {
                    "name": "title",
                    "description": "Product title",
                    "type": "string",
                    "example": "normal title"
                  },
                  "variant_id": {
                    "name": "variant_id",
                    "description": "Product sku",
                    "type": "string",
                    "example": "18057243001210740422372124"
                  }
                },
                "example": {
                  "original_unit_price_set": {
                    "presentment_money": {
                      "amount": "20.0",
                      "currency_code": "USD"
                    },
                    "shop_money": {
                      "amount": "20.0",
                      "currency_code": "USD"
                    }
                  },
                  "quantity": "1",
                  "required_shipping": true,
                  "taxable": true,
                  "title": "normal title",
                  "variant_id": "18057243001210740422372124",
                  "added_discount_staged_change": {
                    "description": "Custom discount",
                    "fixed_value": {
                      "amount": "2.0",
                      "currency_code": "USD"
                    },
                    "id": "6070492985350956144",
                    "percent_value": "0"
                  },
                  "id": "6070492982498829423"
                }
              },
              "calculated_order": {
                "name": "calculated_order",
                "description": "Edit order draft order information",
                "type": "object",
                "properties": {
                  "committed": {
                    "name": "committed",
                    "description": "Have submitted save to order or not",
                    "type": "boolean",
                    "example": true
                  },
                  "id": {
                    "name": "id",
                    "description": "Order editing draft order id",
                    "type": "string",
                    "example": "2106068787725276328168095160459272"
                  }
                },
                "example": {
                  "committed": true,
                  "id": "2106068787725276328168095160459272"
                }
              }
            },
            "example": {
              "calculated_order": {
                "committed": true,
                "id": "2106068787725276328168095160459272"
              },
              "user_errors": [
                {
                  "field": [
                    "[\"id\"]"
                  ],
                  "message": "unauthorized access",
                  "code": "UNAUTHORIZED_ACCESS"
                }
              ],
              "calculated_line_item": {
                "added_discount_staged_change": {
                  "fixed_value": {
                    "currency_code": "USD",
                    "amount": "2.0"
                  },
                  "id": "6070492985350956144",
                  "percent_value": "0",
                  "description": "Custom discount"
                },
                "id": "6070492982498829423",
                "original_unit_price_set": {
                  "presentment_money": {
                    "currency_code": "USD",
                    "amount": "20.0"
                  },
                  "shop_money": {
                    "amount": "20.0",
                    "currency_code": "USD"
                  }
                },
                "quantity": "1",
                "required_shipping": true,
                "taxable": true,
                "title": "normal title",
                "variant_id": "18057243001210740422372124"
              }
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "post",
  "path": "/orders/order_edit_add_line_item_discount.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` ."
        }
      }
    }
  ],
  "info": {
    "title": "Add product discount",
    "version": "v20270301"
  },
  "authIndexes": [
    "write_orders"
  ]
}
```