# Discounts

Discounts are reductions of the regular price of a product or service in order to obtain or increase sales. Businesses can configure discounts in Ristecho in many ways according to their needs.

# The Discount Object

# Sample

{
  "products": [
    {
      "id": "gdch667"
    }
  ],
  "product_tags": [
    {
      "id": "68y5y"
    }
  ],
  "categories": [
    {
      "id": "57fhr"
    }
  ],
  "combos": [
    {
      "id": "564fft"
    }
  ],
  "branches": [
    {
      "id": "46rf4"
    }
  ],
  "id": "8cd1956b",
  "name": "Sprint Discount",
  "name_localized": null,
  "qualification": 3,
  "amount": 10,
  "minimum_product_price": 50,
  "minimum_order_price": 150,
  "maximum_amount": 900,
  "is_percentage": true,
  "is_taxable": true,
  "reference": "dis01",
  "order_types": [
    1,
    3
  ],
  "created_at": "2019-02-28 10:56:57",
  "updated_at": "2019-02-28 10:56:57",
  "deleted_at": null
}

# Attributes

Field Type Rule Description
id string Unique identifier for the discount.
name* string updatable Name of the discount
name_localized string nullable updatable Localized name of the discount.
qualification integer The Discount Qualification.
amount* double updatable The discount amount.
minimum_product_price double updatable The minimum price of a product where the discount is applicable when added at product level
minimum_order_price* double updatable The minimum price of an order where the discount is applicable when added at order level
maximum_amount double updatable If discount is a percentage, this attribute represents the maximum amount the discount could be.
is_percentage* boolean updatable Indicates if the discount is a percentage or not.
is_taxable boolean updatable Indicates if the discount is a taxable or not.
reference string updatable Unique reference for the discount
order_types array updatable The Orders Types where the discount can be applied
products array updatable includable List of Product objects that the discount can be applied on.
combos array updatable includable List of Combo objects that the discount can be applied on.
branches array updatable includable List of Branch objects that the discount can be applied in.
product_tags array updatable includable List of Tag objects that the discount can be applied on.
categories array updatable includable List of Category objects that the discount can be applied on.
customer_tags array updatable includable List of Tag objects that the discount can be applied on.
created_at string sortable Time YYYY-MM-DD HH-MM-SS in UTC at which the object was created.
updated_at string sortable Time YYYY-MM-DD HH-MM-SS in UTC at which the object was updated.
deleted_at string nullable Time YYYY-MM-DD HH-MM-SS in UTC at which the object was deleted.

# Discount Qualifications

Type Description
1 Product.
2 Order.
3 Both.

# List Discounts

GET /discounts

# Scope

general.read

# Filters

  • id
  • name
  • name_localized
  • reference
  • qualification
  • is_percentage
  • is_taxable
  • updated_after
  • is_deleted
  • created_on
  • updated_on
  • deleted_on

# Response

{
  "data": [
    {
      "products": [
        {
          "id": "gdch667"
        }
      ],
      "product_tags": [
        {
          "id": "68y5y"
        }
      ],
      "categories": [
        {
          "id": "57fhr"
        }
      ],
      "combos": [
        {
          "id": "564fft"
        }
      ],
      "branches": [
        {
          "id": "46rf4"
        }
      ],
      "id": "8cd1956b",
      "name": "Sprint Discount",
      "name_localized": null,
      "qualification": 3,
      "amount": 10,
      "minimum_product_price": 50,
      "minimum_order_price": 150,
      "maximum_amount": 900,
      "is_percentage": true,
      "is_taxable": true,
      "reference": "dis01",
      "order_types": [
        1,
        3
      ],
      "created_at": "2019-02-28 10:56:57",
      "updated_at": "2019-02-28 10:56:57",
      "deleted_at": null
    }
  ]
}

# Get Discount

GET /discounts/{discountId}

# Scope

general.read

# Response

{
  "data": [
    {
      "products": [
        {
          "id": "gdch667"
        }
      ],
      "product_tags": [
        {
          "id": "68y5y"
        }
      ],
      "categories": [
        {
          "id": "57fhr"
        }
      ],
      "combos": [
        {
          "id": "564fft"
        }
      ],
      "branches": [
        {
          "id": "46rf4"
        }
      ],
      "id": "8cd1956b",
      "name": "Sprint Discount",
      "name_localized": null,
      "qualification": 3,
      "amount": 10,
      "minimum_product_price": 50,
      "minimum_order_price": 150,
      "maximum_amount": 900,
      "is_percentage": true,
      "is_taxable": true,
      "reference": "dis01",
      "order_types": [
        1,
        3
      ],
      "created_at": "2019-02-28 10:56:57",
      "updated_at": "2019-02-28 10:56:57",
      "deleted_at": null
    }
  ]
}

# Create Discount

POST /discounts

# Scope

admin.write

# Request

{
    "name": "Sprint Discount",
    "name_localized": null,
    "qualification": 3,
    "amount": 10,
    "minimum_product_price": 50,
    "minimum_order_price": 150,
    "maximum_amount": 900,
    "is_percentage": true,
    "is_taxable": true,
    "reference": "dis01",
    "order_types": [
        1,
        3
    ],
    "products": [
        {
            "id": "8cd1956b"
        }
    ],
    "combos": [
        {
            "id": "8cd1956b"
        }
    ],
    "product_tags": [
        {
            "id": "8cd1956b"
        }
    ],
    "categories": [
        {
            "id": "8cd1956b"
        }
    ],
    "branches": [
        {
            "id": "8cd1956b"
        }
    ],
    "customer_tags": [
        {
            "id": "8cd1956b"
        }
    ]
}

# Response

{
  "data": [
    {
      "products": [
        {
          "id": "gdch667"
        }
      ],
      "product_tags": [
        {
          "id": "68y5y"
        }
      ],
      "categories": [
        {
          "id": "57fhr"
        }
      ],
      "combos": [
        {
          "id": "564fft"
        }
      ],
      "branches": [
        {
          "id": "46rf4"
        }
      ],
      "id": "8cd1956b",
      "name": "Sprint Discount",
      "name_localized": null,
      "qualification": 3,
      "amount": 10,
      "minimum_product_price": 50,
      "minimum_order_price": 150,
      "maximum_amount": 900,
      "is_percentage": true,
      "is_taxable": true,
      "reference": "dis01",
      "order_types": [
        1,
        3
      ],
      "created_at": "2019-02-28 10:56:57",
      "updated_at": "2019-02-28 10:56:57",
      "deleted_at": null
    }
  ]
}

# Update Discount

PUT /discounts/{discountId}

# Scope

admin.write

# Request

{
    "name": "Sprint Discount",
    "name_localized": null,
    "amount": 10,
    "minimum_product_price": 50,
    "minimum_order_price": 150,
    "maximum_amount": 900,
    "is_percentage": true,
    "is_taxable": true,
    "reference": "dis01",
    "order_types": [
        1,
        3
    ],
    "products": [
        {
            "id": "8cd1956b"
        }
    ],
    "combos": [
        {
            "id": "8cd1956b"
        }
    ],
    "product_tags": [
        {
            "id": "8cd1956b"
        }
    ],
    "categories": [
        {
            "id": "8cd1956b"
        }
    ],
    "branches": [
        {
            "id": "8cd1956b"
        }
    ],
    "customer_tags": [
        {
            "id": "8cd1956b"
        }
    ]
}

# Response

{
  "data": [
    {
      "products": [
        {
          "id": "gdch667"
        }
      ],
      "product_tags": [
        {
          "id": "68y5y"
        }
      ],
      "categories": [
        {
          "id": "57fhr"
        }
      ],
      "combos": [
        {
          "id": "564fft"
        }
      ],
      "branches": [
        {
          "id": "46rf4"
        }
      ],
      "id": "8cd1956b",
      "name": "Sprint Discount",
      "name_localized": null,
      "qualification": 3,
      "amount": 10,
      "minimum_product_price": 50,
      "minimum_order_price": 150,
      "maximum_amount": 900,
      "is_percentage": true,
      "is_taxable": true,
      "reference": "dis01",
      "order_types": [
        1,
        3
      ],
      "created_at": "2019-02-28 10:56:57",
      "updated_at": "2019-02-28 10:56:57",
      "deleted_at": null
    }
  ]
}

# Delete Discount

DELETE /discounts/{discountId}

# Scope

admin.write

The API will respond with 200 indicating that the discount has been deleted.

# Restore Discount

PUT /discounts/{discountId}/restore

# Scope

admin.restore

The API will respond with 200 indicating that the discount has been restored.

Last Updated: 10/9/2023, 12:54:58 PM