> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firmhouse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage discount codes

> Create and manage discount codes in Firmhouse that customers can apply during checkout or when creating subscriptions through the Firmhouse API.

You can offer discounts that get activated on checkout by creating discount codes. A discount code can then be used by your customer on the checkout step or when creating a subscription via the Firmhouse API.

When creating a discount code you must choose which discount will get activated with the code. Discounts themselves are managed separately from discount codes. In practice, you will first create a discount and then create one or multiple codes that will activate a specific discount on checkout.

The reason why it is set up this way is so that you can also automatically or manually apply a certain discount for a customer without your customer having to use a code on checkout.

To learn how to create discounts and what discount options you have, please see [Giving discounts to your customers](https://docs.firmhouse.com/configure/discounts/giving-discounts.md).

## Creating a Discount Code

First of all, make sure you already have a discount available in your Firmhouse project. Discounts can be created via the **Discounts** sidebar menu.

### Steps

1. From your Firmhouse project, click **Discount Codes** in the sidebar or menu.
2. On the **Discount Codes** page, click the **Create discount code** button on the top-right.
3. In the **Discount code** field enter the text of the discount code that your customers will enter at checkout. Be aware that discount codes are currently **case sensitive**.
4. In the **Number of times this code can be used in total** field enter how many checkouts can use this code.
5. In the **Discount to apply** dropdown, select the Discount you want to activate with this code.

If the selected discount is a **manual tiered discount**, the same Firmhouse discount code is also available at Shopify checkout for eligible subscription checkouts.

![Discount codes page](https://mintcdn.com/firmhousebv/i0tAuZcoMZU4WKIb/images/docs-configure-discounts-managing-discount-codes-page-dev-aa.png?fit=max\&auto=format\&n=i0tAuZcoMZU4WKIb\&q=85\&s=2b1aaa910c98b01a2cbb140f07fdde94)

## Checking Required Plans via the API

If you build a custom checkout or storefront, you can use the GraphQL API to check which plans a discount code is restricted to.

Use `getDiscountCode` and read the attached promotion's `requiredPlans` field. This field lists the plans configured under the discount's required-plan rules.

```graphql theme={null}
query GetDiscountCode($code: ID!) {
  getDiscountCode(code: $code) {
    code
    promotion {
      requiredPlans {
        id
        slug
        name
      }
    }
  }
}
```

When `requiredPlans` is empty, the attached discount does not have plan-specific requirements. The legacy `autoSelectPlan` field only reflects the optional single plan configured directly on the discount code.

## Removing or Disabling a Discount Code

Discount codes are automatically disabled when their usage limit has been reached. You can also fully disable and remove a discount code immediately.

### Steps

1. From your Firmhouse project, click **Discount Codes** in the sidebar or menu.
2. On the **Discount Codes** page, find the discount code you want to remove.
3. Click **Remove**

> When removing or disabling a discount code, the attached discount is not impacted. Customers that have the associated discount already active will keep that discount. You can also apply discounts to a customer manually, even if there are no (active) codes for it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.