Applied discounts

Applied discounts are immutable records created when a reusable discount or Shopify discount is applied to an invoice or checkout session. Each record snapshots the name, entered code, and economic terms at the time of application, so later discount changes do not alter historical transactions.

The Applied Discounts API is read-only. Create discounts to define reusable terms, then apply a discount by ID or redeem its code. The applied discount’s discount field references the reusable Bias discount that produced it, while its nullable code field snapshots a Bias or Shopify customer-entered code. Shopify applied discounts have no reusable Bias discount reference.

The AppliedDiscount object

Name
object
Type
"applied_discount",
Description
Literal representing the object's type.
Name
id
Type
string,
Description
Unique identifier for the object.
Name
live
Type
boolean,
Description
Has the value true if the object exists in a production environment or the value false if the object exists in a sandbox environment.
Name
created_at
Type
integer,
Description
Time at which the object was created. Measured in milliseconds since the Unix epoch.
Name
amount_off
Type
integer or null,
Description
The snapshotted fixed discount amount in cents.
Name
code
Type
string or null,
Description
The code entered by the customer when this discount was code-redeemed.
Name
customer
Type
string or Customer or null,
Description
Expandable. The customer associated with this redemption.
Name
discount
Type
string or Discount or null,
Description
Expandable. The reusable discount used to create this applied discount.
Name
name
Type
string,
Description
The snapshotted display name.
Name
percent_off
Type
number or null,
Description
The snapshotted percentage discount amount.
Name
target
Type
enum,
Description
Whether the discount applies to merchandise or shipping.
Properties

The AppliedDiscount object

{
  "object": "applied_discount",
  "id": "apd_lXk5TJ6ygKsjdXXRXb1DW6",
  "live": false,
  "created_at": 1750000000000,
  "discount": "di_0yejjs3V3DfgTCMZdtKIu7",
  "code": "SAVE10",
  "target": "line_items",
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "name": "10% off",
  "amount_off": null,
  "percent_off": 10
}

Get an applied discount

Retrieve an applied discount by its ID.

Required parameters

Name
id
Type
string,
Description
The ID of the applied discount to retrieve.

Optional parameters

Name
expand
Type
object,
Properties

Returns

Returns the applied discount object.

Retrieve an applied discount

const appliedDiscount = await bias.appliedDiscounts.get("id");

Response example

{
  "object": "applied_discount",
  "id": "apd_lXk5TJ6ygKsjdXXRXb1DW6",
  "live": false,
  "created_at": 1750000000000,
  "discount": "di_0yejjs3V3DfgTCMZdtKIu7",
  "code": "SAVE10",
  "target": "line_items",
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "name": "10% off",
  "amount_off": null,
  "percent_off": 10
}

List all applied discounts

Returns a list of applied discounts in reverse chronological order, with the most recently created records appearing first. Filter by discount, code, customer, name, or creation date.

Optional parameters

Name
expand
Type
object,
Properties
Name
ending_before
Type
string,
Description
A cursor for use in pagination. ending_before is an object ID that results will end before. Used to move backward through the list.
Name
starting_after
Type
string,
Description
A cursor for use in pagination. starting_after is an object ID that results will start after. Used to move forward through the list.
Name
limit
Type
number, at least 1, at most 1000, default is 50
Description
Maximum number of objects to return.
Name
filters
Type
object, object, or object,
Description
Filters to apply to the list. Combine multiple conditions with and and or.
Properties

Returns

Returns a list of applied discount objects.

List all applied discounts

const appliedDiscount = await bias.appliedDiscounts.list();

Response example

{
  "object": "list",
  "items": {
    "object": "applied_discount",
    "id": "apd_lXk5TJ6ygKsjdXXRXb1DW6",
    "live": false,
    "created_at": 1750000000000,
    "discount": "di_0yejjs3V3DfgTCMZdtKIu7",
    "code": "SAVE10",
    "target": "line_items",
    "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
    "name": "10% off",
    "amount_off": null,
    "percent_off": 10
  },
  "has_more": false
}
Previous
Next

Built by Bias in California