Applied discounts

An applied discount records a discount applied to an invoice, checkout session or line item, with the name, code and terms it had at the time. Renaming or deleting the discount doesn’t change past transactions.

The AppliedDiscount object

Name
object
Type
"applied_discount",
Description
The object's type.
Name
id
Type
string,
Description
Unique identifier for the object.
Name
live
Type
boolean,
Description
true if the object is live, or false if it's in a sandbox.
Name
created_at
Type
integer,
Description
When the object was created, in milliseconds since the Unix epoch.
Name
amount_off
Type
integer or null,
Description
The amount off in cents when the discount was applied.
Name
code
Type
string or null,
Description
The code the customer entered, or null when it was applied without one.
Name
customer
Type
string or Customer or null,
Description
Expandable. The customer the discount was applied for.
Name
discount
Type
string or Discount or null,
Description
Expandable. The discount this was applied from.
Name
name
Type
string,
Description
The discount's name when it was applied.
Name
percent_off
Type
number or null,
Description
The percentage off when the discount was applied.
Name
target
Type
enum,
Description
What the discount applies to. Only discounts from a connected Shopify store apply to 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,
Description
Related objects to expand in the response.
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

Retrieve a paginated list of applied discounts, most recently created first.

Optional parameters

Name
expand
Type
object,
Description
Related objects to expand in the response.
Properties
Name
ending_before
Type
string,
Description
The ID of the object to list before, for pagination.
Name
starting_after
Type
string,
Description
The ID of the object to list after, for pagination.
Name
limit
Type
integer, at least 1, at most 1000, default is 50
Description
The maximum number of objects to return, from 1 to 1000. Defaults to 50.
Name
filters
Type
object, object, or object,
Description
Filters for the list, combined 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": true
}