Skip to content

Evaluate a member's cart against the spend programme

POST
/discounts/evaluate

For a sale on a non-Shopify channel: the automatic discounts the spend programme in force gives this member’s cart, and for each redeemable card what it takes off the cart now and which automatic discounts redeeming it would remove. Writes nothing.

object
customer
required

The member, by the channel their external id lives on.

object
channel
required
string
external_id
required
string
channel
required

The channel the sale happens on; the lines’ product and collection ids belong to it. Not shopify: a Shopify checkout is priced by the checkout itself.

string
Allowed values: lightspeed pos api
program

The programme to act in: its handle (for example vv) or its lower-case id. Optional on a workspace with one programme; on a workspace with several, a call that names none is refused with 400 program_required. A programme that is not this workspace’s is 404 not_found.

string
cart
required
object
lines
required
Array<object>
object
line_id
required
string
product_id
required
string
collection_ids
required

Null = membership unknown (never eligible).

array | null
quantity
required
integer
> 0
line_subtotal_cents
required
integer
compare_at_price_cents

The variant’s compare-at price per unit (minor units). Omitted means the line has none: a percentage card priced on compare-at takes its percentage of the selling price.

integer
shipping_cents

The shipping charge a 0-point Free shipping card would remove. Default 0.

integer

The evaluation.

object
spend_version_id
required

The spend programme version in force that was evaluated.

string format: uuid
automatic
required
object
lines
required

The automatic discount each line gets, when no points are redeemed.

Array<object>
object
card_id
required
string format: uuid
title
required
string
discount_cents
required
integer
line_id
required
string
order
required
object
card_id
required
string format: uuid
title
required
string
discount_cents
required
integer
shipping
required
object
card_id
required
string format: uuid
title
required
string
discount_cents
required
integer
redeemable
required
Array
object
id
required
string format: uuid
type
required
string
Allowed values: value_fixed value_variable value_percentage product_specific product_from_set free_shipping perk_early_access perk_gated_product perk_experience perk_physical
label
required
string
mechanism
required
string
Allowed values: discount_code function webhook
trigger_surfaces
required
Array<string>
Allowed values: in_cart account_page auto_apply
cost_model
required
object
key
additional properties
cost_points
required
integer | null
constraints
required
object
min_spend_cents
required
integer | null
eligible_collection_ids
required
Array<string>
eligible_product_ids
required
Array<string>
stackable
required
boolean
per_customer_cap
required
object
count
required
integer
window
required
string
tier_gate
required
string | null
value_cap_cents
required
integer | null
kind
required

The spend card kind.

string
Allowed values: points_value fixed_reward product_reward free_shipping perk discount
placeable
required

Whether POST /v1/redemptions can place this card (Points value cards, and Fixed reward cards the programme can price).

boolean
product
required

A Product reward’s product, one unit of which the reward frees; null for every other kind.

object
id
required

The product’s id on channel.

string
name
required

The product’s name as saved on the card.

string
channel
required

The channel the product id belongs to.

string
Allowed values: shopify lightspeed pos api
redeemable_now_value_cents
required

What redeeming this card takes off this cart now (0 = not redeemable now). For a Product reward, the price of the one unit it frees: the highest per-unit price (line subtotal ÷ quantity, rounded down) among the lines of its product. null for a Free shipping or Perk card.

integer | null
forfeits
required

The automatic discounts that redemption would remove.

Array<object>
object
card_id
required
string format: uuid
title
required
string
discount_cents
required
integer

A malformed body, channel shopify, or the program is malformed (not a lower-case programme id or a programme handle), or a workspace with several programmes was given none (program_required).

object
error
required
object
code
required
string
Example
not_found
message
required
string
details
request_id
required
string
Example
req_9f8e7d6c5b4a3210

Missing or invalid API key or OAuth credential.

object
error
required
object
code
required
string
Example
not_found
message
required
string
details
request_id
required
string
Example
req_9f8e7d6c5b4a3210

The credential lacks the loyalty:read scope — a publishable key (publishable_key_forbidden).

object
error
required
object
code
required
string
Example
not_found
message
required
string
details
request_id
required
string
Example
req_9f8e7d6c5b4a3210

No such customer in this tenant, or the program names no programme of this workspace (not_found).

object
error
required
object
code
required
string
Example
not_found
message
required
string
details
request_id
required
string
Example
req_9f8e7d6c5b4a3210

No spend programme is in force (option_not_eligible, details.reason: no_spend_programme).

object
error
required
object
code
required
string
Example
not_found
message
required
string
details
request_id
required
string
Example
req_9f8e7d6c5b4a3210