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

# Get Discount

> Retrieve details of a specific discount code

Retrieves detailed information about a specific discount code by its public ID, including type, value, usage statistics, validity period, and associated products.

## Path Parameters

<ParamField path="discountPublicId" type="string" required>
  The unique discount identifier (e.g., `dis_abc123`)
</ParamField>

## Response

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="id" type="string">
      Unique discount identifier (e.g., `dis_abc123`)
    </ResponseField>

    <ResponseField name="name" type="string">
      Display name of the discount
    </ResponseField>

    <ResponseField name="code" type="string">
      The discount code customers use at checkout
    </ResponseField>

    <ResponseField name="type" type="string">
      Discount type (`percentage` or `fixed`)
    </ResponseField>

    <ResponseField name="status" type="string">
      Discount status (`active` or `expired`)
    </ResponseField>

    <ResponseField name="value_off" type="object">
      Discount value information

      <Expandable title="properties">
        <ResponseField name="raw" type="number">
          Raw discount value (percentage number or amount in currency units)
        </ResponseField>

        <ResponseField name="formatted" type="string">
          Human-readable formatted value (e.g., `20%` or `$10.00`)
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="products" type="array">
      Array of products this discount applies to (empty if applies to all products)
    </ResponseField>

    <ResponseField name="store" type="object">
      Store information (simplified)
    </ResponseField>

    <ResponseField name="customer_email" type="string">
      Email of customer this discount is restricted to (null if no restriction)
    </ResponseField>

    <ResponseField name="usage_limit" type="integer">
      Maximum number of uses (null if unlimited)
    </ResponseField>

    <ResponseField name="usage_count" type="integer">
      Number of times the discount has been used
    </ResponseField>

    <ResponseField name="start_date" type="string">
      ISO 8601 timestamp when discount becomes active (null if no start restriction)
    </ResponseField>

    <ResponseField name="end_date" type="string">
      ISO 8601 timestamp when discount expires (null if no expiration)
    </ResponseField>

    <ResponseField name="is_auto_generated" type="boolean">
      Whether the discount was automatically generated by the system
    </ResponseField>

    <ResponseField name="created_at" type="string">
      ISO 8601 timestamp when discount was created
    </ResponseField>

    <ResponseField name="updated_at" type="string">
      ISO 8601 timestamp when discount was last updated
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.chariow.com/v1/discounts/dis_abc123" \
    -H "Authorization: Bearer sk_live_your_api_key"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.chariow.com/v1/discounts/dis_abc123', {
    headers: {
      'Authorization': 'Bearer sk_live_your_api_key'
    }
  });
  const { message, data } = await response.json();
  ```

  ```php PHP theme={null}
  $ch = curl_init('https://api.chariow.com/v1/discounts/dis_abc123');
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer sk_live_your_api_key'
  ]);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $response = curl_exec($ch);
  $result = json_decode($response, true);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.chariow.com/v1/discounts/dis_abc123',
      headers={'Authorization': 'Bearer sk_live_your_api_key'}
  )
  discount = response.json()['data']
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "message": "success",
    "data": {
      "id": "dis_abc123",
      "name": "Summer Sale",
      "code": "SUMMER20",
      "type": "percentage",
      "status": "active",
      "value_off": {
        "raw": 20,
        "formatted": "20%"
      },
      "products": [
        {
          "id": "prd_def456",
          "name": "Premium Course",
          "type": "course",
          "pictures": {
            "thumbnail": "https://cdn.chariow.com/thumb.jpg",
            "cover": "https://cdn.chariow.com/cover.jpg"
          },
          "category": {
            "value": "education",
            "label": "Education"
          },
          "pricing": {
            "type": "one_time",
            "price": {
              "value": 9999,
              "formatted": "$99.99",
              "short": "100",
              "currency": "USD"
            }
          },
          "bundle": null
        }
      ],
      "store": {
        "id": "str_xyz789",
        "name": "My Store"
      },
      "customer_email": null,
      "usage_limit": 100,
      "usage_count": 15,
      "start_date": "2025-01-01T00:00:00+00:00",
      "end_date": "2025-12-31T23:59:59+00:00",
      "is_auto_generated": false,
      "created_at": "2025-01-01T00:00:00+00:00",
      "updated_at": "2025-01-15T10:30:00+00:00"
    },
    "errors": []
  }
  ```

  ```json Not Found (404) theme={null}
  {
    "message": "No query results for model [App\\Models\\Discount].",
    "data": [],
    "errors": []
  }
  ```
</ResponseExample>
