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

# Ürün Oluşturma

> Modern ödeme altyapısı için güçlü ve esnek API çözümü

<Note>
  Ödeme işlemlerinizde kullanmak üzere ürün oluşturabilirsiniz. Ürünler, ödeme işlemlerinizin temelini oluşturur ve her ürün için fiyat, açıklama gibi bilgileri saklayabilirsiniz.

  Detaylı yönetim için Tahsilat arayüzünden ürünlerinizi yönetebilirsiniz.
</Note>

<Warning>
  Tahsilat.com için ödeme işlemlerinde ürün bilgisi zorunludur.
</Warning>

<br />

İstek:

<CodeGroup>
  ```php PHP theme={null}
  $tahsilat = new TahsilatClient('sk_test_rwwg...');

  $product = $tahsilat->products->create([
      'product_name' => 'Premium Subscription',
      'price' => 9999,
      'description' => 'Monthly premium subscription',
      'metadata' => [
          'category' => 'subscription'
      ]
  ]);
  ```

  ```csharp .NET theme={null}
  var tahsilat = new TahsilatClient("sk_test_rwwg...");

  var request = new ProductCreateRequest
  {
      ProductName = "Premium Subscription",
      Price = 9999,
      Description = "Integration Test Product",
      Metadata = new()
      {
          new Dictionary<string, object>
          {
              ["category"] = "subscription",
          },
      }
  };

  var response = await tahsilat.Products.CreateAsync(request);
  ```

  ```curl cURL theme={null}
  curl -L 'https://api.tahsilat.com/v1/products' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Accept-Language: tr' \
  -H 'Authorization: Bearer {access_token}' \
  -d 'product_name=Premium Subscription' \
  -d 'price=9999' \
  -d 'description=Monthly premium subscription' \
  -d 'metadata={"category":"subscription"}'
  ```
</CodeGroup>

<br />

Yanıt:

<CodeGroup>
  ```php PHP theme={null}

  ^ Tahsilat\Resource\Product {
      "id": 55195540441484
      "merchant_id": 1234567
      "product_name": "Premium Subscription"
      "price": 9999
      "currency_code": "TRY"
      "quantity": 1
      "description": "Monthly premium subscription"
      "product_image": null
      "created_at": "2025-06-11T20:48:31+03:00"
      "updated_at": "2025-06-11T20:48:31+03:00"
      "formatted_price": "99,99"
      "formatted_created_at": "11 Haz, 2025, 20:48"
      "system_id": 7
      "metadata": array:1 [
          0 => array:5 [
              "merchant_id" => "1234567"
              "key" => "category"
              "value" => "subscription"
              "created_at" => "2025-06-11T20:48:31+03:00"
              "updated_at" => "2025-06-11T20:48:31+03:00"
          ]
      ]
      "timeline": array:1 [
          0 => array:5 [
              "type" => "created"
              "order" => 1
              "text" => "Ürün oluşturuldu."
              "date" => "11.06.2025 20:48"
              "icon" => "fa-user-clock"
          ]
      ]
  }
  ```

  ```csharp .NET theme={null}
  {
    "Id": 31733022327942,
    "MerchantId": 1234567,
    "ProductName": "Premium Subscription",
    "Price": 9999,
    "CurrencyCode": "TRY",
    "Quantity": 1,
    "Description": "Integration Test Product",
    "ProductImage": null,
    "CreatedAt": "2025-06-11T20:48:31+03:00",
    "UpdatedAt": "2025-06-11T20:48:31+03:00",
    "FormattedPrice": "99,99",
    "FormattedCreatedAt": "4 Mar, 00:50",
    "SystemId": 2,
    "Metadata": [
      {
        "Key": "category",
        "Value": "subscription"
      }
    ],
    "Timeline": [
      {
        "Type": "created",
        "Order": 1,
        "Text": "Müşteri Oluşturuldu.",
        "Date": "04.03.2026 00:50",
        "Icon": "fa-user-clock"
      }
    ]
  }
  ```
</CodeGroup>

<br />

Ödeme Başlatma

<CodeGroup>
  ```php PHP theme={null}
  $tahsilat = new TahsilatClient('sk_test_rwwg...');

  $product = $tahsilat->products->create([
      'product_name' => 'Premium Subscription',
      'price' => 9999,
      'description' => 'Monthly premium subscription',
      'metadata' => [
      'category' => 'subscription'
      ]
  ]);

  $payment = $tahsilat->payments->create([
      'currency' => 'TRY',
      'amount' => 1000,
      'product_ids' => [
          $product->id
      ],
  ]);
  ```

  ```csharp .NET theme={null}
  var tahsilat = new TahsilatClient("sk_test_rwwg...");

  var productRequest = new ProductCreateRequest
  {
      ProductName = "Premium Subscription",
      Price = 9999,
      Description = "Integration Test Product",
      Metadata = new()
      {
          new Dictionary<string, object>
          {
              ["category"] = "subscription",
          },
      }
  };

  var productResponse = await tahsilat.Products.CreateAsync(productRequest);

  var paymentRequest = new PaymentCreateRequest
  {
      Amount = 1000,
      Currency = "TRY",
      CustomerId = productResponse.Id,
      Metadata = new()
      {
          new Dictionary<string, object>
          {
              ["order_id"] = 123456,
              ["customer_type"] = "premium"
          },
      },
  };

  var paymentResponse = await tahsilat.Payments.CreateAsync(paymentRequest);
  ```
</CodeGroup>

## Zorunlu ve İsteğe Bağlı Parametreler

<ResponseField name="product_name" type="string" required>
  Ürünün adı. Bu alan zorunludur ve ürünün tanımlanmasında kullanılır.
</ResponseField>

<ResponseField name="price" type="integer" required>
  Ürünün fiyatı. Bu alan zorunludur ve ürünün satış fiyatını belirtir. Fiyat, kuruş cinsinden belirtilmelidir (örneğin, 99,99 TL için 9999).
</ResponseField>

<ResponseField name="description" type="string">
  Ürünün açıklaması. Bu alan isteğe bağlıdır ancak ürünün ne olduğunu açıklamak için kullanışlıdır.

  Açıklama belirtildiği takdirde, Ödeme arayüzünde de görüntülenir.
</ResponseField>

<ResponseField name="metadata" type="array">
  Ürüne ait ek verileri içeren dizi. Bu parametre isteğe bağlıdır, ancak ürün yönetimi ve raporlaması için önerilir. Örneğin, kategori, stok durumu gibi bilgiler burada saklanabilir.
</ResponseField>

<div className="panels">
  <Panel>
    <CodeGroup>
      ```md Endpoint theme={null}
      POST /v1/products
      POST /v1/products/:product_id
      GET /v1/products/:product_id
      GET /v1/products/search?:sources
      DEL /v1/products/:product_id
      ```
    </CodeGroup>

    <br />

    İstek

    <CodeGroup>
      ```php PHP theme={null}
      $tahsilat = new TahsilatClient('sk_test_rwwg...');

      $product = $tahsilat->products->create([
          'product_name' => 'Premium Subscription',
          'price' => 9999,
          'description' => 'Monthly premium subscription',
          'metadata' => [
              'category' => 'subscription'
          ]
      ]);
      ```

      ```csharp .NET theme={null}
      var tahsilat = new TahsilatClient("sk_test_rwwg...");

      var request = new ProductCreateRequest
      {
          ProductName = "Premium Subscription",
          Price = 9999,
          Description = "Integration Test Product",
          Metadata = new()
          {
              new Dictionary<string, object>
              {
                  ["category"] = "subscription",
              },
          }
      };

      var response = await tahsilat.Products.CreateAsync(request);
      ```

      ```curl cURL theme={null}
      curl -L 'https://api.tahsilat.com/v1/products' \
      -H 'Content-Type: application/x-www-form-urlencoded' \
      -H 'Accept-Language: tr' \
      -H 'Authorization: Bearer {access_token}' \
      -d 'product_name=Premium Subscription' \
      -d 'price=9999' \
      -d 'description=Monthly premium subscription' \
      -d 'metadata={"category":"subscription"}'
      ```
    </CodeGroup>

    <br />

    Yanıt

    <CodeGroup>
      ```php PHP theme={null}
      ^ Tahsilat\Resource\Product {
          "id": 55195540441484,
          "merchant_id": 1234567,
          "product_name": "Premium Subscription",
          "price": 9999,
          "currency_code": "TRY",
          "quantity": 1,
          "description": "Monthly premium subscription",
          "product_image": null,
          "created_at": "2025-06-11T20:48:31+03:00",
          "updated_at": "2025-06-11T20:48:31+03:00",
          "formatted_price": "99,99",
          "formatted_created_at": "11 Haz, 2025, 20:48",
          "system_id": 7,
          "metadata": array:1 [
              0 => array:5 [
                  "merchant_id" => "1234567",
                  "key" => "category",
                  "value" => "subscription",
                  "created_at" => "2025-06-11T20:48:31+03:00",
                  "updated_at" => "2025-06-11T20:48:31+03:00"
              ]
          ],
          "timeline": array:1 [
              0 => array:5 [
                  "type" => "created",
                  "order" => 1,
                  "text" => "Ürün oluşturuldu.",
                  "date" => "11.06.2025 20:48",
                  "icon" => "fa-user-clock"
              ]
          ]
      }
      ```

      ```csharp .NET theme={null}
      {
        "Id": 31733022327942,
        "MerchantId": 1234567,
        "ProductName": "Premium Subscription",
        "Price": 9999,
        "CurrencyCode": "TRY",
        "Quantity": 1,
        "Description": "Integration Test Product",
        "ProductImage": null,
        "CreatedAt": "2025-06-11T20:48:31+03:00",
        "UpdatedAt": "2025-06-11T20:48:31+03:00",
        "FormattedPrice": "99,99",
        "FormattedCreatedAt": "4 Mar, 00:50",
        "SystemId": 2,
        "Metadata": [
          {
            "Key": "category",
            "Value": "subscription"
          }
        ],
        "Timeline": [
          {
            "Type": "created",
            "Order": 1,
            "Text": "Müşteri Oluşturuldu.",
            "Date": "04.03.2026 00:50",
            "Icon": "fa-user-clock"
          }
        ]
      }
      ```
    </CodeGroup>
  </Panel>
</div>
