---
displayed_sidebar: jsClientSidebar
slug: /references/js-client/AdminDiscountsResource
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# AdminDiscountsResource

This class is used to send requests to [Admin Discount API Routes](https://docs.medusajs.com/api/admin#discounts). All its method
are available in the JS Client under the `medusa.admin.discounts` property.

All methods in this class require [user authentication](js_client.AdminAuthResource.mdx#createsession).

Admins can create discounts with conditions and rules, providing them with advanced settings for variety of cases.
The methods in this class can be used to manage discounts, their conditions, resources, and more.

Related Guide: [How to manage discounts](https://docs.medusajs.com/modules/discounts/admin/manage-discounts).

## Methods

### addConditionResourceBatch

Add a batch of resources to a discount condition. The type of resource depends on the type of discount condition. For example, if the discount condition's type is `products`,
the resources being added should be products.

#### Example

To add resources to a discount condition:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.addConditionResourceBatch(discountId, conditionId, {
  resources: [{ id: itemId }]
})
.then(({ discount }) => {
  console.log(discount.id);
})
```

To specify relations to include in the returned discount:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.addConditionResourceBatch(discountId, conditionId, {
  resources: [{ id: itemId }]
}, {
  expand: "rule"
})
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "discountId",
    "type": "`string`",
    "description": "The ID of the discount the condition belongs to.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "conditionId",
    "type": "`string`",
    "description": "The ID of the discount condition.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "payload",
    "type": "[AdminPostDiscountsDiscountConditionsConditionBatchReq](../../medusa/classes/medusa.AdminPostDiscountsDiscountConditionsConditionBatchReq.mdx)",
    "description": "The resources to add to the discount condition.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "resources",
        "type": "`object`[]",
        "description": "The resources to be added to the discount condition",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "id",
            "type": "`string`",
            "description": "The ID of the item",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  },
  {
    "name": "query",
    "type": "[AdminPostDiscountsDiscountConditionsConditionBatchParams](../../medusa/classes/medusa.AdminPostDiscountsDiscountConditionsConditionBatchParams.mdx)",
    "description": "Configurations to apply on the retrieved discount.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "expand",
        "type": "`string`",
        "description": "Comma-separated relations that should be expanded in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "fields",
        "type": "`string`",
        "description": "Comma-separated fields that should be included in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the details of the discount.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### addRegion

Add a Region to the list of Regions a Discount can be used in.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.addRegion(discountId, regionId)
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The discount's ID.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "regionId",
    "type": "`string`",
    "description": "The ID of the region to add.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the discount's details.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### create

Create a discount with a given set of rules that defines how the discount is applied.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
import { AllocationType, DiscountRuleType } from "@medusajs/medusa"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.create({
  code: "TEST",
  rule: {
    type: DiscountRuleType.FIXED,
    value: 10,
    allocation: AllocationType.ITEM
  },
  regions: ["reg_XXXXXXXX"],
  is_dynamic: false,
  is_disabled: false
})
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "payload",
    "type": "[AdminPostDiscountsReq](../../medusa/classes/medusa.AdminPostDiscountsReq.mdx)",
    "description": "The discount to create.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "code",
        "type": "`string`",
        "description": "A unique code that will be used to redeem the discount",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "ends_at",
        "type": "`Date`",
        "description": "The date and time at which the discount should no longer be available.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "is_disabled",
        "type": "`boolean`",
        "description": "Whether the discount code is disabled on creation. If set to `true`, it will not be available for customers.",
        "optional": false,
        "defaultValue": "false",
        "expandable": false,
        "children": []
      },
      {
        "name": "is_dynamic",
        "type": "`boolean`",
        "description": "Whether the discount should have multiple instances of itself, each with a different code. This can be useful for automatically generated discount codes that all have to follow a common set of rules.",
        "optional": false,
        "defaultValue": "false",
        "expandable": false,
        "children": []
      },
      {
        "name": "metadata",
        "type": "`Record<string, unknown>`",
        "description": "An optional set of key-value pairs to hold additional information.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "regions",
        "type": "`string`[]",
        "description": "A list of region IDs representing the Regions in which the Discount can be used.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "rule",
        "type": "[AdminPostDiscountsDiscountRule](../../medusa/classes/medusa.AdminPostDiscountsDiscountRule.mdx)",
        "description": "The discount rule that defines how discounts are calculated",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "allocation",
            "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
            "description": "The discount rule's allocation.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "ITEM",
                "type": "`\"item\"`",
                "description": "The discount should be applied to applicable items in the cart.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "TOTAL",
                "type": "`\"total\"`",
                "description": "The discount should be applied to the checkout total.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "conditions",
            "type": "[AdminCreateCondition](../../medusa/classes/medusa.AdminCreateCondition.mdx)[]",
            "description": "The discount rule's conditions.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "customer_groups",
                "type": "`string`[]",
                "description": "The customer groups associated with the discount condition, if the discount condition's type is `customer_groups`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "operator",
                "type": "[DiscountConditionOperator](../../entities/enums/entities.DiscountConditionOperator.mdx)",
                "description": "The operator of the discount condition.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "product_collections",
                "type": "`string`[]",
                "description": "The product collections associated with the discount condition, if the discount condition's type is `product_collections`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "product_tags",
                "type": "`string`[]",
                "description": "The product tags associated with the discount condition, if the discount condition's type is `product_tags`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "product_types",
                "type": "`string`[]",
                "description": "The product types associated with the discount condition, if the discount condition's type is `product_types`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "products",
                "type": "`string`[]",
                "description": "The products associated with the discount condition, if the discount condition's type is `products`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "description",
            "type": "`string`",
            "description": "The discount rule's description.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "type",
            "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
            "description": "The discount rule's type.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "FIXED",
                "type": "`\"fixed\"`",
                "description": "Discounts that reduce the price by a fixed amount.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "FREE_SHIPPING",
                "type": "`\"free_shipping\"`",
                "description": "Discounts that sets the shipping price to `0`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "PERCENTAGE",
                "type": "`\"percentage\"`",
                "description": "Discounts that reduce the price by a percentage reduction.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "value",
            "type": "`number`",
            "description": "The discount rule's value.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "starts_at",
        "type": "`Date`",
        "description": "The date and time at which the discount should be available.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "usage_limit",
        "type": "`number`",
        "description": "Maximum number of times the discount can be used",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "valid_duration",
        "type": "`string`",
        "description": "The duration the discount runs between",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the discount's details.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### createCondition

Create a discount condition. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided in the `payload` parameter, 
based on the type of discount condition. For example, if the discount condition's type is `products`, the `products` field should be provided in the `payload` parameter.

#### Example

To create a condition in a discount:

```ts
import Medusa from "@medusajs/medusa-js"
import { DiscountConditionOperator } from "@medusajs/medusa"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.createCondition(discountId, {
  operator: DiscountConditionOperator.IN,
  products: [productId]
})
.then(({ discount }) => {
  console.log(discount.id);
})
```

To specify relations that should be retrieved as part of the response:

```ts
import Medusa from "@medusajs/medusa-js"
import { DiscountConditionOperator } from "@medusajs/medusa"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.createCondition(discountId, {
  operator: DiscountConditionOperator.IN,
  products: [productId]
}, {
  expand: "rule"
})
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "discountId",
    "type": "`string`",
    "description": "The discount's ID.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "payload",
    "type": "[AdminPostDiscountsDiscountConditions](../../medusa/classes/medusa.AdminPostDiscountsDiscountConditions.mdx)",
    "description": "The discount condition to create.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "customer_groups",
        "type": "`string`[]",
        "description": "The customer groups associated with the discount condition, if the discount condition's type is `customer_groups`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "operator",
        "type": "[DiscountConditionOperator](../../entities/enums/entities.DiscountConditionOperator.mdx)",
        "description": "Operator of the condition. `in` indicates that discountable resources are within the specified resources. `not\\_in` indicates that discountable resources are everything but the specified resources.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "IN",
            "type": "`\"in\"`",
            "description": "The discountable resources are within the specified resources.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "NOT_IN",
            "type": "`\"not_in\"`",
            "description": "The discountable resources are everything but the specified resources.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "product_collections",
        "type": "`string`[]",
        "description": "The product collections associated with the discount condition, if the discount condition's type is `product_collections`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "product_tags",
        "type": "`string`[]",
        "description": "The product tags associated with the discount condition, if the discount condition's type is `product_tags`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "product_types",
        "type": "`string`[]",
        "description": "The product types associated with the discount condition, if the discount condition's type is `product_types`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "products",
        "type": "`string`[]",
        "description": "The products associated with the discount condition, if the discount condition's type is `products`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "query",
    "type": "[AdminPostDiscountsDiscountConditionsParams](../../medusa/classes/medusa.AdminPostDiscountsDiscountConditionsParams.mdx)",
    "description": "Configurations to apply on the returned discount.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": [
      {
        "name": "expand",
        "type": "`string`",
        "description": "Comma-separated relations that should be expanded in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "fields",
        "type": "`string`",
        "description": "Comma-separated fields that should be included in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the details of the discount.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### createDynamicCode

Create a dynamic unique code that can map to a parent discount. This is useful if you want to automatically generate codes with the same rules and conditions.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.createDynamicCode(discountId, {
  code: "TEST",
  usage_limit: 1
})
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The discount's ID.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "payload",
    "type": "[AdminPostDiscountsDiscountDynamicCodesReq](../../medusa/classes/medusa.AdminPostDiscountsDiscountDynamicCodesReq.mdx)",
    "description": "The dynamic code to create.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "code",
        "type": "`string`",
        "description": "A unique code that will be used to redeem the Discount",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "metadata",
        "type": "`Record<string, unknown>`",
        "description": "An optional set of key-value pairs to hold additional information.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "usage_limit",
        "type": "`number`",
        "description": "Maximum number of times the discount code can be used",
        "optional": false,
        "defaultValue": "1",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the details of the discount.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### delete

Delete a discount. Deleting the discount will make it unavailable for customers to use.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.delete(discountId)
.then(({ id, object, deleted }) => {
  console.log(id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The discount's ID.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;DeleteResponse&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the delete operation details.",
    "expandable": false,
    "children": [
      {
        "name": "deleted",
        "type": "`boolean`",
        "description": "Whether the item was deleted successfully.",
        "optional": false,
        "defaultValue": "true",
        "expandable": false,
        "children": []
      },
      {
        "name": "id",
        "type": "`string`",
        "description": "The ID of the deleted item.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "object",
        "type": "`string`",
        "description": "The type of the deleted item.",
        "optional": false,
        "defaultValue": "product-collection",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />

___

### deleteCondition

Delete a discount condition. This doesn't delete resources associated to the discount condition.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.deleteCondition(discountId, conditionId)
.then(({ id, object, deleted }) => {
  console.log(id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "discountId",
    "type": "`string`",
    "description": "The discount's ID.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "conditionId",
    "type": "`string`",
    "description": "The ID of the discount condition.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;DeleteResponse&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the deletion operation details.",
    "expandable": false,
    "children": [
      {
        "name": "deleted",
        "type": "`boolean`",
        "description": "Whether the item was deleted successfully.",
        "optional": false,
        "defaultValue": "true",
        "expandable": false,
        "children": []
      },
      {
        "name": "id",
        "type": "`string`",
        "description": "The ID of the deleted item.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "object",
        "type": "`string`",
        "description": "The type of the deleted item.",
        "optional": false,
        "defaultValue": "product-collection",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />

___

### deleteConditionResourceBatch

Remove a batch of resources from a discount condition. This will only remove the association between the resource and the discount condition, not the resource itself.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.deleteConditionResourceBatch(discountId, conditionId, {
  resources: [{ id: itemId }]
})
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "discountId",
    "type": "`string`",
    "description": "The ID of the discount the condition belongs to.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "conditionId",
    "type": "`string`",
    "description": "The ID of the discount condition.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "payload",
    "type": "[AdminDeleteDiscountsDiscountConditionsConditionBatchReq](../../medusa/classes/medusa.AdminDeleteDiscountsDiscountConditionsConditionBatchReq.mdx)",
    "description": "The resources to remove.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "resources",
        "type": "`object`[]",
        "description": "The resources to be removed from the discount condition",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "id",
            "type": "`string`",
            "description": "The id of the item",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the details of the discount.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### deleteDynamicCode

Delete a dynamic code from a discount.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.deleteDynamicCode(discountId, code)
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The discount's ID.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "code",
    "type": "`string`",
    "description": "The code of the dynamic code to delete.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the details of the discount.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### getCondition

Retrieve a Discount Condition's details.

#### Example

A simple example that retrieves a discount condition by its ID:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.getCondition(discountId, conditionId)
.then(({ discount_condition }) => {
  console.log(discount_condition.id);
})
```

To specify relations that should be retrieved:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.getCondition(discountId, conditionId, {
  expand: "discount_rule"
})
.then(({ discount_condition }) => {
  console.log(discount_condition.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "discountId",
    "type": "`string`",
    "description": "The ID of the discount that the condition belongs to.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "conditionId",
    "type": "`string`",
    "description": "The ID of the discount condition.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "query",
    "type": "[AdminGetDiscountsDiscountConditionsConditionParams](../../medusa/classes/medusa.AdminGetDiscountsDiscountConditionsConditionParams.mdx)",
    "description": "Configurations to apply on the retrieved discount condition.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "expand",
        "type": "`string`",
        "description": "Comma-separated relations that should be expanded in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "fields",
        "type": "`string`",
        "description": "Comma-separated fields that should be included in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountConditionsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the discount condition details.",
    "expandable": false,
    "children": [
      {
        "name": "discount_condition",
        "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)",
        "description": "Discount condition details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "customer_groups",
            "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
            "description": "Customer groups associated with this condition if `type` is `customer\\_groups`.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "customers",
                "type": "[Customer](../../entities/classes/entities.Customer.mdx)[]",
                "description": "The details of the customers that belong to the customer group.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The customer group's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the customer group",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "price_lists",
                "type": "[PriceList](../../entities/classes/entities.PriceList.mdx)[]",
                "description": "The price lists that are associated with the customer group.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "discount_rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule associated with the condition.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "discount_rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule associated with the condition",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount condition's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "operator",
            "type": "[DiscountConditionOperator](../../entities/enums/entities.DiscountConditionOperator.mdx)",
            "description": "The operator of the condition. `in` indicates that discountable resources are within the specified resources. `not\\_in` indicates that discountable resources are everything but the specified resources.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "IN",
                "type": "`\"in\"`",
                "description": "The discountable resources are within the specified resources.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "NOT_IN",
                "type": "`\"not_in\"`",
                "description": "The discountable resources are everything but the specified resources.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "product_collections",
            "type": "[ProductCollection](../../entities/classes/entities.ProductCollection.mdx)[]",
            "description": "Product collections associated with this condition if `type` is `product\\_collections`.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "handle",
                "type": "`string`",
                "description": "A unique string that identifies the Product Collection - can for example be used in slug structures.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The product collection's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "products",
                "type": "[Product](../../entities/classes/entities.Product.mdx)[]",
                "description": "The details of the products that belong to this product collection.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "title",
                "type": "`string`",
                "description": "The title that the Product Collection is identified by.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "product_tags",
            "type": "[ProductTag](../../entities/classes/entities.ProductTag.mdx)[]",
            "description": "Product tags associated with this condition if `type` is `product\\_tags`.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The product tag's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`string`",
                "description": "The value that the Product Tag represents",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "product_types",
            "type": "[ProductType](../../entities/classes/entities.ProductType.mdx)[]",
            "description": "Product types associated with this condition if `type` is `product\\_types`.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The product type's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`string`",
                "description": "The value that the Product Type represents.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "products",
            "type": "[Product](../../entities/classes/entities.Product.mdx)[]",
            "description": "products associated with this condition if `type` is `products`.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "categories",
                "type": "[ProductCategory](../../entities/classes/entities.ProductCategory.mdx)[]",
                "description": "The details of the product categories that this product belongs to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "featureFlag": "product_categories",
                "children": []
              },
              {
                "name": "collection",
                "type": "[ProductCollection](../../entities/classes/entities.ProductCollection.mdx)",
                "description": "The details of the product collection that the product belongs to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "collection_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the product collection that the product belongs to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`null` \\| `string`",
                "description": "A short description of the Product.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "discountable",
                "type": "`boolean`",
                "description": "Whether the Product can be discounted. Discounts will not apply to Line Items of this Product when this flag is set to `false`.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "external_id",
                "type": "`null` \\| `string`",
                "description": "The external ID of the product",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "handle",
                "type": "`null` \\| `string`",
                "description": "A unique identifier for the Product (e.g. for slug structure).",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "height",
                "type": "`null` \\| `number`",
                "description": "The height of the Product Variant. May be used in shipping rate calculations.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "hs_code",
                "type": "`null` \\| `string`",
                "description": "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The product's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "images",
                "type": "[Image](../../entities/classes/entities.Image.mdx)[]",
                "description": "The details of the product's images.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "is_giftcard",
                "type": "`boolean`",
                "description": "Whether the Product represents a Gift Card. Products that represent Gift Cards will automatically generate a redeemable Gift Card code once they are purchased.",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "children": []
              },
              {
                "name": "length",
                "type": "`null` \\| `number`",
                "description": "The length of the Product Variant. May be used in shipping rate calculations.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "material",
                "type": "`null` \\| `string`",
                "description": "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`null` \\| `Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "mid_code",
                "type": "`null` \\| `string`",
                "description": "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "options",
                "type": "[ProductOption](../../entities/classes/entities.ProductOption.mdx)[]",
                "description": "The details of the Product Options that are defined for the Product. The product's variants will have a unique combination of values of the product's options.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "origin_country",
                "type": "`null` \\| `string`",
                "description": "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "profile",
                "type": "[ShippingProfile](../../entities/classes/entities.ShippingProfile.mdx)",
                "description": "The details of the shipping profile that the product belongs to. The shipping profile has a set of defined shipping options that can be used to fulfill the product.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "profile_id",
                "type": "`string`",
                "description": "The ID of the shipping profile that the product belongs to. The shipping profile has a set of defined shipping options that can be used to fulfill the product.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "profiles",
                "type": "[ShippingProfile](../../entities/classes/entities.ShippingProfile.mdx)[]",
                "description": "Available if the relation `profiles` is expanded.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "sales_channels",
                "type": "[SalesChannel](../../entities/classes/entities.SalesChannel.mdx)[]",
                "description": "The details of the sales channels this product is available in.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "status",
                "type": "[ProductStatus](../../entities/enums/entities.ProductStatus.mdx)",
                "description": "The status of the product",
                "optional": false,
                "defaultValue": "draft",
                "expandable": false,
                "children": []
              },
              {
                "name": "subtitle",
                "type": "`null` \\| `string`",
                "description": "An optional subtitle that can be used to further specify the Product.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tags",
                "type": "[ProductTag](../../entities/classes/entities.ProductTag.mdx)[]",
                "description": "The details of the product tags used in this product.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "thumbnail",
                "type": "`null` \\| `string`",
                "description": "A URL to an image file that can be used to identify the Product.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "title",
                "type": "`string`",
                "description": "A title that can be displayed for easy identification of the Product.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[ProductType](../../entities/classes/entities.ProductType.mdx)",
                "description": "The details of the product type that the product belongs to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "type_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the product type that the product belongs to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "variants",
                "type": "[ProductVariant](../../entities/classes/entities.ProductVariant.mdx)[]",
                "description": "The details of the Product Variants that belong to the Product. Each will have a unique combination of values of the product's options.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "weight",
                "type": "`null` \\| `number`",
                "description": "The weight of the Product Variant. May be used in shipping rate calculations.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "width",
                "type": "`null` \\| `number`",
                "description": "The width of the Product Variant. May be used in shipping rate calculations.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "type",
            "type": "[DiscountConditionType](../../entities/enums/entities.DiscountConditionType.mdx)",
            "description": "The type of the condition. The type affects the available resources associated with the condition. For example, if the type is `products`, that means the `products` relation will hold the products associated with this condition and other relations will be empty.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "CUSTOMER_GROUPS",
                "type": "`\"customer_groups\"`",
                "description": "The discount condition is used for customer groups.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "PRODUCTS",
                "type": "`\"products\"`",
                "description": "The discount condition is used for products.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "PRODUCT_COLLECTIONS",
                "type": "`\"product_collections\"`",
                "description": "The discount condition is used for product collections.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "PRODUCT_TAGS",
                "type": "`\"product_tags\"`",
                "description": "The discount condition is used for product tags.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "PRODUCT_TYPES",
                "type": "`\"product_types\"`",
                "description": "The discount condition is used for product types.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### list

Retrieve a list of Discounts. The discounts can be filtered by fields such as `rule` or `is_dynamic`. The discounts can also be paginated.

#### Example

To list discounts:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.list()
.then(({ discounts, limit, offset, count }) => {
  console.log(discounts.id);
})
```

To specify relations that should be retrieved within the discounts:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.list({
  expand: "rule"
})
.then(({ discounts, limit, offset, count }) => {
  console.log(discounts.id);
})
```

By default, only the first `20` records are retrieved. You can control pagination by specifying the `limit` and `offset` properties:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.list({
  expand: "rule",
  limit,
  offset
})
.then(({ discounts, limit, offset, count }) => {
  console.log(discounts.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "query",
    "type": "[AdminGetDiscountsParams](../../medusa/classes/medusa.AdminGetDiscountsParams.mdx)",
    "description": "Filters and pagination configurations to apply on the retrieved discounts.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "expand",
        "type": "`string`",
        "description": "Comma-separated relations that should be expanded in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "fields",
        "type": "`string`",
        "description": "Comma-separated fields that should be included in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "is_disabled",
        "type": "`boolean`",
        "description": "Filter discounts by whether they're disabled.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "is_dynamic",
        "type": "`boolean`",
        "description": "Filter discounts by whether they're dynamic.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "limit",
        "type": "`number`",
        "description": "Limit the number of items returned in the list.",
        "optional": true,
        "defaultValue": "20",
        "expandable": false,
        "children": []
      },
      {
        "name": "offset",
        "type": "`number`",
        "description": "The number of items to skip when retrieving a list.",
        "optional": true,
        "defaultValue": "0",
        "expandable": false,
        "children": []
      },
      {
        "name": "q",
        "type": "`string`",
        "description": "Search terms to search discounts' code fields.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "rule",
        "type": "[AdminGetDiscountsDiscountRuleParams](../../medusa/classes/medusa.AdminGetDiscountsDiscountRuleParams.mdx)",
        "description": "Filter discounts by their associated rule.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "allocation",
            "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
            "description": "Allocation to filter discount rules by.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "ITEM",
                "type": "`\"item\"`",
                "description": "The discount should be applied to applicable items in the cart.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "TOTAL",
                "type": "`\"total\"`",
                "description": "The discount should be applied to the checkout total.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "type",
            "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
            "description": "Type to filter discount rules by.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "FIXED",
                "type": "`\"fixed\"`",
                "description": "Discounts that reduce the price by a fixed amount.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "FREE_SHIPPING",
                "type": "`\"free_shipping\"`",
                "description": "Discounts that sets the shipping price to `0`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "PERCENTAGE",
                "type": "`\"percentage\"`",
                "description": "Discounts that reduce the price by a percentage reduction.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          }
        ]
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsListRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the list of discounts with pagination fields.",
    "expandable": false,
    "children": [
      {
        "name": "AdminDiscountsListRes",
        "type": "[PaginatedResponse](../../medusa/interfaces/medusa.PaginatedResponse.mdx) & `object`",
        "description": "The list of discounts with pagination fields.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "count",
            "type": "`number`",
            "description": "The total number of items available.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "limit",
            "type": "`number`",
            "description": "The maximum number of items that can be returned in the list.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "offset",
            "type": "`number`",
            "description": "The number of items skipped before the returned items in the list.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "discounts",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)[]",
            "description": "The list of discounts.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          }
        ]
      }
    ]
  }
]} />

___

### removeRegion

Remove a Region from the list of Regions that a Discount can be used in. This does not delete a region, only the association between it and the discount.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.removeRegion(discountId, regionId)
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The discount's ID.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "regionId",
    "type": "`string`",
    "description": "The ID of the region to remove.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the details of the discount.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### retrieve

Retrieve a discount.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.retrieve(discountId)
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The discount's ID.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the details of the discount.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### retrieveByCode

Retrieve a discount's details by its discount code.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.retrieveByCode(code)
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "code",
    "type": "`string`",
    "description": "The code of the discount.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the details of the discount.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### update

Update a discount with a given set of rules that define how the discount is applied.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.update(discountId, {
  code: "TEST"
})
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The discount's ID.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "payload",
    "type": "[AdminPostDiscountsDiscountReq](../../medusa/classes/medusa.AdminPostDiscountsDiscountReq.mdx)",
    "description": "The attributes to update in the discount.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "code",
        "type": "`string`",
        "description": "A unique code that will be used to redeem the discount",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "ends_at",
        "type": "`null` \\| `Date`",
        "description": "The date and time at which the discount should no longer be available.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "is_disabled",
        "type": "`boolean`",
        "description": "Whether the discount code is disabled on creation. If set to `true`, it will not be available for customers.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "metadata",
        "type": "`Record<string, unknown>`",
        "description": "An object containing metadata of the discount",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "regions",
        "type": "`string`[]",
        "description": "A list of region IDs representing the Regions in which the Discount can be used.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "rule",
        "type": "[AdminUpdateDiscountRule](../../medusa/classes/medusa.AdminUpdateDiscountRule.mdx)",
        "description": "The discount rule that defines how discounts are calculated",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "allocation",
            "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
            "description": "The discount rule's allocation.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "ITEM",
                "type": "`\"item\"`",
                "description": "The discount should be applied to applicable items in the cart.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "TOTAL",
                "type": "`\"total\"`",
                "description": "The discount should be applied to the checkout total.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "conditions",
            "type": "[AdminUpsertCondition](../../medusa/classes/medusa.AdminUpsertCondition.mdx)[]",
            "description": "The discount rule's discount conditions.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "customer_groups",
                "type": "`string`[]",
                "description": "The customer groups associated with the discount condition, if the discount condition's type is `customer_groups`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount condition's ID.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "operator",
                "type": "[DiscountConditionOperator](../../entities/enums/entities.DiscountConditionOperator.mdx)",
                "description": "The discount condition's operator.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "product_collections",
                "type": "`string`[]",
                "description": "The product collections associated with the discount condition, if the discount condition's type is `product_collections`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "product_tags",
                "type": "`string`[]",
                "description": "The product tags associated with the discount condition, if the discount condition's type is `product_tags`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "product_types",
                "type": "`string`[]",
                "description": "The product types associated with the discount condition, if the discount condition's type is `product_types`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "products",
                "type": "`string`[]",
                "description": "The products associated with the discount condition, if the discount condition's type is `products`.",
                "optional": true,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "description",
            "type": "`string`",
            "description": "The discount rule's description.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount rule's ID.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "value",
            "type": "`number`",
            "description": "The discount rule's value.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "starts_at",
        "type": "`Date`",
        "description": "The date and time at which the discount should be available.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "usage_limit",
        "type": "`null` \\| `number`",
        "description": "Maximum number of times the discount can be used",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "valid_duration",
        "type": "`null` \\| `string`",
        "description": "The duration the discount runs between",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the details of the discount.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### updateCondition

Update a discount condition. Only one of `products`, `product_types`, `product_collections`, `product_tags`, and `customer_groups` should be provided in the `payload` parameter,
based on the type of discount condition. For example, if the discount condition's type is `products`, the `products` field should be provided in the `payload` parameter.

#### Example

To update a condition in a discount:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.updateCondition(discountId, conditionId, {
  products: [
    productId
  ]
})
.then(({ discount }) => {
  console.log(discount.id);
})
```

To specify relations that should be retrieved as part of the response:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.discounts.updateCondition(discountId, conditionId, {
  products: [
    productId
  ]
}, {
  expand: "rule"
})
.then(({ discount }) => {
  console.log(discount.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "discountId",
    "type": "`string`",
    "description": "The discount's ID.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "conditionId",
    "type": "`string`",
    "description": "The ID of the discount condition.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "payload",
    "type": "[AdminPostDiscountsDiscountConditionsCondition](../../medusa/classes/medusa.AdminPostDiscountsDiscountConditionsCondition.mdx)",
    "description": "The attributes to update in the discount condition.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "customer_groups",
        "type": "`string`[]",
        "description": "The customer groups associated with the discount condition, if the discount condition's type is `customer_groups`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "product_collections",
        "type": "`string`[]",
        "description": "The product collections associated with the discount condition, if the discount condition's type is `product_collections`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "product_tags",
        "type": "`string`[]",
        "description": "The product tags associated with the discount condition, if the discount condition's type is `product_tags`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "product_types",
        "type": "`string`[]",
        "description": "The product types associated with the discount condition, if the discount condition's type is `product_types`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "products",
        "type": "`string`[]",
        "description": "The products associated with the discount condition, if the discount condition's type is `products`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "query",
    "type": "[AdminPostDiscountsDiscountConditionsConditionParams](../../medusa/classes/medusa.AdminPostDiscountsDiscountConditionsConditionParams.mdx)",
    "description": "Configurations to apply on the returned discount.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": [
      {
        "name": "expand",
        "type": "`string`",
        "description": "Comma-separated relations that should be expanded in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "fields",
        "type": "`string`",
        "description": "Comma-separated fields that should be included in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminDiscountsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the details of the discount.",
    "expandable": false,
    "children": [
      {
        "name": "discount",
        "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
        "description": "Discount details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "code",
            "type": "`string`",
            "description": "A unique code for the discount - this will be used by the customer to apply the discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "ends_at",
            "type": "`null` \\| `Date`",
            "description": "The time at which the discount can no longer be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The discount's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_disabled",
            "type": "`boolean`",
            "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "is_dynamic",
            "type": "`boolean`",
            "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "parent_discount",
            "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
            "description": "The details of the parent discount that this discount was created from.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "code",
                "type": "`string`",
                "description": "A unique code for the discount - this will be used by the customer to apply the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The time at which the discount can no longer be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_disabled",
                "type": "`boolean`",
                "description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "is_dynamic",
                "type": "`boolean`",
                "description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "parent_discount",
                "type": "[Discount](../../entities/classes/entities.Discount.mdx)",
                "description": "The details of the parent discount that this discount was created from.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "parent_discount_id",
                "type": "`string`",
                "description": "The Discount that the discount was created from. This will always be a dynamic discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "regions",
                "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
                "description": "The details of the regions in which the Discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule",
                "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
                "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "rule_id",
                "type": "`string`",
                "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`Date`",
                "description": "The time at which the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_count",
                "type": "`number`",
                "description": "The number of times a discount has been used.",
                "optional": false,
                "defaultValue": "0",
                "expandable": false,
                "children": []
              },
              {
                "name": "usage_limit",
                "type": "`null` \\| `number`",
                "description": "The maximum number of times that a discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "valid_duration",
                "type": "`null` \\| `string`",
                "description": "Duration the discount runs between",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "parent_discount_id",
            "type": "`string`",
            "description": "The Discount that the discount was created from. This will always be a dynamic discount",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "regions",
            "type": "[Region](../../entities/classes/entities.Region.mdx)[]",
            "description": "The details of the regions in which the Discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "automatic_taxes",
                "type": "`boolean`",
                "description": "Whether taxes should be automated in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "countries",
                "type": "[Country](../../entities/classes/entities.Country.mdx)[]",
                "description": "The details of the countries included in this region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "currency",
                "type": "[Currency](../../entities/classes/entities.Currency.mdx)",
                "description": "The details of the currency used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "currency_code",
                "type": "`string`",
                "description": "The three character currency code used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "fulfillment_providers",
                "type": "[FulfillmentProvider](../../entities/classes/entities.FulfillmentProvider.mdx)[]",
                "description": "The details of the fulfillment providers that can be used to fulfill items of orders and similar resources in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "gift_cards_taxable",
                "type": "`boolean`",
                "description": "Whether the gift cards are taxable or not in this region.",
                "optional": false,
                "defaultValue": "true",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The region's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the prices for the region include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the region as displayed to the customer. If the Region only has one country it is recommended to write the country name.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "payment_providers",
                "type": "[PaymentProvider](../../entities/classes/entities.PaymentProvider.mdx)[]",
                "description": "The details of the payment providers that can be used to process payments in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_code",
                "type": "`string`",
                "description": "The tax code used on purchases in the Region. This may be used by other systems for accounting purposes.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_provider",
                "type": "[TaxProvider](../../entities/classes/entities.TaxProvider.mdx)",
                "description": "The details of the tax provider used in the region.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "tax_provider_id",
                "type": "`null` \\| `string`",
                "description": "The ID of the tax provider used in this region",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rate",
                "type": "`number`",
                "description": "The tax rate that should be charged on purchases in the Region.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "tax_rates",
                "type": "`null` \\| [TaxRate](../../entities/classes/entities.TaxRate.mdx)[]",
                "description": "The details of the tax rates used in the region, aside from the default rate.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule",
            "type": "[DiscountRule](../../entities/classes/entities.DiscountRule.mdx)",
            "description": "The details of the discount rule that defines how the discount will be applied to a cart..",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "allocation",
                "type": "[AllocationType](../../entities/enums/entities.AllocationType.mdx)",
                "description": "The scope that the discount should apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "conditions",
                "type": "[DiscountCondition](../../entities/classes/entities.DiscountCondition.mdx)[]",
                "description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "A short description of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The discount rule's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[DiscountRuleType](../../entities/enums/entities.DiscountRuleType.mdx)",
                "description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free\\_shipping` for shipping vouchers.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "value",
                "type": "`number`",
                "description": "The value that the discount represents; this will depend on the type of the discount",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "rule_id",
            "type": "`string`",
            "description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "starts_at",
            "type": "`Date`",
            "description": "The time at which the discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_count",
            "type": "`number`",
            "description": "The number of times a discount has been used.",
            "optional": false,
            "defaultValue": "0",
            "expandable": false,
            "children": []
          },
          {
            "name": "usage_limit",
            "type": "`null` \\| `number`",
            "description": "The maximum number of times that a discount can be used.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "valid_duration",
            "type": "`null` \\| `string`",
            "description": "Duration the discount runs between",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />
