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

# التحقق من تفاصيل المنتج

> احصل على التسعير التفصيلي والفئات والمخزون لمنتج محدد

<div dir="rtl">
  ## نظرة عامة

  يعيد أنواع/فئات المنتج مع الأسعار في الوقت الفعلي وتوافر المخزون.

  <Warning>
    الأسعار مخصصة لحسابك. **احذف `cost` قبل عرضه للمستخدمين.**
  </Warning>

  ## معاملات المسار

  <ParamField path="productId" type="string" required>
    معرف المنتج من endpoint الـ `/catalog`
  </ParamField>

  ## الاستجابة

  <ResponseField name="data" type="object">
    <Expandable title="الخصائص">
      <ResponseField name="types" type="array">
        مصفوفة كائنات نوع/فئة المنتج

        <Expandable title="كائن النوع">
          <ResponseField name="id" type="string">
            معرف النوع (للاستخدام عند تقديم الطلبات)
          </ResponseField>

          <ResponseField name="name" type="string">
            اسم النوع/الفئة (مثال: "100 DA"، "1000 DA")
          </ResponseField>

          <ResponseField name="price" type="number">
            سعرك (يشمل الخصم)
          </ResponseField>

          <ResponseField name="quantity" type="number">
            المخزون المتاح (0 = نفد من المخزون)
          </ResponseField>
        </Expandable>
      </ResponseField>
    </Expandable>
  </ResponseField>

  ## أمثلة

  <CodeGroup>
    ```bash cURL theme={null}
    curl https://api.oneclickdz.com/v3/gift-cards/checkProduct/507f1f77bcf86cd799439011 \
      -H "X-Access-Token: YOUR_API_KEY"
    ```

    ```javascript Node.js theme={null}
    const productId = "507f1f77bcf86cd799439011";
    const response = await fetch(
      `https://api.oneclickdz.com/v3/gift-cards/checkProduct/${productId}`,
      { headers: { "X-Access-Token": "YOUR_API_KEY" } }
    );
    const { data } = await response.json();

    // Filter in-stock items
    const available = data.types.filter((t) => t.quantity > 0);
    ```

    ```python Python theme={null}
    product_id = '507f1f77bcf86cd799439011'
    response = requests.get(
        f'https://api.oneclickdz.com/v3/gift-cards/checkProduct/{product_id}',
        headers={'X-Access-Token': 'YOUR_API_KEY'}
    )
    types = response.json()['data']['types']

    # Filter available
    available = [t for t in types if t['quantity'] > 0]
    ```

    ```php PHP theme={null}
    <?php
    $productId = '507f1f77bcf86cd799439011';
    $ch = curl_init("https://api.oneclickdz.com/v3/gift-cards/checkProduct/{$productId}");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-Access-Token: YOUR_API_KEY']);
    $response = curl_exec($ch);
    $data = json_decode($response, true);
    $types = $data['data']['types'];

    // Filter available
    $available = array_filter($types, function($t) {
        return $t['quantity'] > 0;
    });
    ?>
    ```
  </CodeGroup>

  ### مثال الاستجابة

  ```json theme={null}
  {
    "success": true,
    "data": {
      "productId": "507f1f77bcf86cd799439011",
      "productTitle": "PlayStation Network",
      "types": [
        {
          "id": "type_001",
          "name": "PSN 500 DA",
          "price": 490,
          "quantity": 150
        },
        {
          "id": "type_002",
          "name": "PSN 1000 DA",
          "price": 980,
          "quantity": 87
        },
        {
          "id": "type_003",
          "name": "PSN 2000 DA",
          "price": 1960,
          "quantity": 0
        }
      ]
    },
    "meta": {
      "timestamp": "2025-10-29T01:00:00.000Z"
    }
  }
  ```

  ## تطبيق هامش الربح

  ```javascript theme={null}
  function applyMarkup(types, markupPercent = 5) {
    return types
      .filter((t) => t.quantity > 0)
      .map((t) => ({
        id: t.id,
        name: t.name,
        price: Math.ceil(t.price * (1 + markupPercent / 100)),
        available: true,
      }));
  }

  // Usage
  const customerPrices = applyMarkup(data.types, 5); // 5% markup
  ```

  ## أفضل الممارسات

  <CardGroup cols={2}>
    <Card title="التحقق من المخزون" icon="warehouse">
      تأكد من `quantity > 0` قبل العرض
    </Card>

    <Card title="تطبيق الهامش" icon="percent">
      أضف هامش ربحك إلى `price`
    </Card>

    <Card title="إخفاء السعر" icon="eye-slash">
      لا تُظهر أبداً `price` الجملة للعملاء
    </Card>

    <Card title="التحديث المنتظم" icon="arrows-rotate">
      قم بتحديث المخزون بشكل دوري
    </Card>
  </CardGroup>

  ## روابط ذات صلة

  <CardGroup cols={2}>
    <Card title="الحصول على الكتالوج" icon="list" href="/ar/api-reference/gift-cards/get-catalog">
      تصفح جميع المنتجات
    </Card>

    <Card title="تقديم طلب" icon="cart-shopping" href="/ar/api-reference/gift-cards/place-order">
      شراء منتج
    </Card>
  </CardGroup>
</div>
