Order Discounts

Applies to: Orders API | Catalog API

Learn how to apply discounts to an order using the Orders API.

Link to section

Overview

Building on the example order created in Order Price Adjustments, learn how to apply discounts to the example order. If your application uses catalog pricing rules to calculate discount amounts, see Automatically Apply Discounts for information about setting up discount pricing rules.

After the Orders API calculates item totals, it considers any available discounts of these types:

  • Discount on order total - A discount can be defined in the order and based on a percentage (for example, 10% off) or based on a fixed amount and then applied to the order total.
  • Discount on line item - A discount can be defined in the order and applied to an individual item or the entire order.
  • Pricing rule discount on line item - A catalog pricing rule for Square-applied order discounts and applied to line items in the order.

If an order has multiple discounts of different scopes and types, they're calculated and applied in this sequence:

  1. Item-level percentage
  2. Order-level percentage
  3. Item-level fixed amount
  4. Order-level fixed amount
Link to section

On items

Chicken-flavored dog biscuits have been discontinued, so this item receives a 7% discount. The applied_discounts attribute tells Square that this line item gets a specific discount and the discounts attribute defines what the discount is. applied_discounts can be set on any line item and reference any discount defined in the order.

Note that applied_discounts is a list, which means that multiple discounts can be applied to a single line item.

The following CalculateOrder request defines the discount (DISCONTINUED-7-PCT) and applies it to Dog Biscuits - Chicken Flavor:

Calculate order

Link to section

On orders

To celebrate National Puppy Day, the entire order receives a 12% discount. The Orders API calculates and applies order-level discounts as line-item price adjustments, so it apportions the discount across all the line-item subtotals. In this case, the applied_discounts attribute isn't used. The discounts attribute uses a scope parameter to tell Square to apply the discount to all line items.

The following CalculateOrder request defines the discount (NATL-PUPPY-12-PCT) to be applied to all the items:

Calculate order

Link to section

On items

To thank customers for their business, a Puppy Appreciation Discount is applied to dog treats. Customers save $3.00 on chicken-flavor dog biscuits and $11.00 on beef-flavor chewy rawhide.

The following CalculateOrder request defines two discounts (APPREC-3-USD and APPREC-11-USD) and applies them to the appropriate items:

Calculate order

Link to section

On orders

To celebrate the storewide Anniversary Sale, a discount of $5.00 is applied to the entire order. The Orders API calculates and applies order-level discounts as line-item price adjustments, so it evenly distributes the discount across all the line-item subtotals.

The following CalculateOrder request defines the discount (ANNI-SALE-5-USD) to be applied to all the items:

Calculate order

The owners of Raphael's Puppy-Care Emporium have decided to offer a Buy One, Get One Free discount to motivate customers to buy combinations of dog biscuit items. To expedite the checkout process, they set up a pricing rule in their catalog to automatically apply discounts. On every order, they add the pricing_options attribute and set auto_apply_discounts. That's all they need to do. When set, any order that contains a catalog item that matches a price rule is automatically discounted.

The following example shows an order for two cases of dog biscuits. The details of the line item are taken from the CatalogItemVariation referenced by catalog_object_id.

Calculate order

Link to section

See also