Requires write_orders access scope.
For more info , refer to:
POST https://{handle}.myshopline.com/admin/openapi/v20250301/orders/order_edit_add_line_item_discount.json
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 .
Request Headers
  • Content-Type required
    The value of this field is fixed to application/json; charset=utf-8
  • Authorization string required
    The access token for the API. Please refer to App authorization to obtain the access token, and then put the obtained access token into the API request header in Bearer Token.
    Example:
    Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
Request Body
  • requestobject required
    Request body
  • discountobject required
    Product discount
  • description string
    Discount description
    Example: Custom discount
  • fixed_valueobject
    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 )
    Example: 2.0
  • currency_code string
    Currency
    Example: USD
  • 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
    Example: 0
  • id string required
    Edit order draft order id , you can get it from call order editing-start interface return parameters
    Example: 21098923432423423423
  • line_item_id string required
    Product row id
    Example: 6070492982498829423
Response
For more information about status codes, see Http status code.

Response Headers
  • traceId
    traceId
Response Body
  • calculated_line_itemobject
    Product information for this editor
  • added_discount_staged_changeobject
    Product line custom discount information
  • description string
    Discount description
    Example: Custom discount
  • fixed_valueobject
    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
    Example: 2.0
  • currency_code string
    Currency
    Example: USD
  • id string
    Discount id
    Example: 6070492985350956144
  • 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
    Example: 0
  • id string
    Order editing Product line id in draft order
    Example: 6070492982498829423
  • original_unit_price_setobject
    Original price , no application favorable price
  • presentment_moneyobject
    Market currency amount information
  • amount string
    Value of amount , 2- bit accuracy string
    Example: 20.0
  • currency_code string
    Currency
    Example: USD
  • shop_moneyobject
    Store currency amount information
  • amount string
    Value of amount , 2- bit accuracy string
    Example: 20.0
  • currency_code string
    Currency
    Example: USD
  • quantity string
    Quantity
    Example: 1
  • required_shipping boolean
    Shipping or not
    Example: true
  • taxable boolean
    Tax or not required
    Example: true
  • title string
    Product title
    Example: normal title
  • variant_id string
    Product sku
    Example: 18057243001210740422372124
  • calculated_orderobject
    Edit order draft order information
  • committed boolean
    Have submitted save to order or not
    Example: true
  • id string
    Order editing draft order id
    Example: 2106068787725276328168095160459272
  • user_errorsobject[]
    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
  • 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
    Example: UNAUTHORIZED_ACCESS
  • field array
    The path to the input field that caused the error. leads to the path of incorrect input fields
    Example: ["id"]
  • message string
    Error message
    Example: unauthorized access
API Explorer
https://openapiceshidianpu.myshopline.com/admin/openapi/v20250301

ParamOptions

— header required

Body

required
{
  "request": {
    "discount": {
      "description": "Custom discount",
      "fixed_value": {
        "amount": "2.0",
        "currency_code": "USD"
      },
      "percent_value": "0"
    },
    "id": "21098923432423423423",
    "line_item_id": "6070492982498829423"
  }
}

Language

curl --request POST \
--url https://openapiceshidianpu.myshopline.com/admin/openapi/v20250301/orders/order_edit_add_line_item_discount.json \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw' \
--header 'Content-Type: application/json; charset=utf-8' \
--header 'accept: application/json'
Was this article helpful to you?

Error loading component.

Error loading component.