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

# Set Coupon on Customer

Applies a coupon to a customer, affecting their subscription pricing.

## Mutation

<CodeGroup>
  ```graphql Mutation theme={null}
  mutation SetCouponOnCustomer($input: SetCouponOnCustomerInput!) {
    setCouponOnCustomer(input: $input) {
      customerId
      coupon {
        code
        type
        discountValue
        duration
      }
    }
  }
  ```

  ```json Variables theme={null}
  {
    "input": {
      "customerId": "customer-123",
      "couponRefId": "SAVE20"
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "setCouponOnCustomer": {
        "customerId": "customer-123",
        "coupon": {
          "code": "SAVE20",
          "type": "PERCENTAGE",
          "discountValue": 20,
          "duration": "FOREVER"
        }
      }
    }
  }
  ```
</CodeGroup>

## Parameters

<ParamField body="input" type="SetCouponOnCustomerInput" required>
  Input for applying a coupon

  <Expandable title="properties">
    <ParamField body="customerId" type="String" required>
      Customer reference ID
    </ParamField>

    <ParamField body="couponRefId" type="String" required>
      Coupon code to apply
    </ParamField>

    <ParamField body="environmentId" type="UUID">
      Environment ID
    </ParamField>
  </Expandable>
</ParamField>

## Return Type

Returns the updated `Customer` with the applied coupon.

## Related Operations

* [Create Coupon](/api-and-sdks/api-reference/mutations/create-coupon) - Create coupon
* [Preview Subscription](/api-and-sdks/api-reference/mutations/preview-subscription) - Preview with coupon
