If your doing this via API you’ll need to create a discount. For example this is the one I created for testing:
{
"object": {
"type": "DISCOUNT",
"id": "6KOR2G2JZV7VNID23YIAFIDR",
"updated_at": "2023-03-07T20:33:14.001Z",
"created_at": "2023-03-07T20:33:14.001Z",
"version": 1678221194001,
"is_deleted": false,
"present_at_all_locations": true,
"discount_data": {
"name": "large",
"discount_type": "FIXED_AMOUNT",
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"application_method": "MANUALLY_APPLIED",
"modify_tax_basis": "MODIFY_TAX_BASIS"
}
}
}
Then you’ll need to create a PRICING_RULE
. This is the one I created:
{
"object": {
"type": "PRICING_RULE",
"id": "YZFUPPLH5AZX4YQTZETBIVSJ",
"updated_at": "2023-03-07T20:33:14.001Z",
"created_at": "2023-03-07T20:33:14.001Z",
"version": 1678221194001,
"is_deleted": false,
"present_at_all_locations": true,
"pricing_rule_data": {
"discount_id": "6KOR2G2JZV7VNID23YIAFIDR",
"match_products_id": "UHJAZJWQVRC3XO7WZCBV6XVD",
"application_mode": "AUTOMATIC",
"discount_target_scope": "LINE_ITEM",
"disabled_pricing_sources": [
"SQUARE_ONLINE"
]
}
}
}
So the product that I added to this pricing rule UHJAZJWQVRC3XO7WZCBV6XVD
has a cost of $1 and the discount I created is a $10 discount. When I created the order with the Orders API with with the blow order it created an order with $0 owed. :
{
"idempotency_key": "{{$guid}}",
"order": {
"location_id": "{{location_id}}",
"reference_id": "my-order-0001",
"line_items": [
{
"quantity": "1",
"catalog_object_id": "M4ZCRV2XZ6E76FC5XDDJZQTK"
}
],
"discounts": [
{
"catalog_object_id": "6KOR2G2JZV7VNID23YIAFIDR"
}
]
}
}
Hope this help.