# Subscription Product

The subscription primarily built around plans, and plans must be associated with products. To create a product, it is sufficient to provide only the name parameter.

A product can have multiple payment plans, and it is possible to perform all these operations both through the API and the iyzico merchant panel.

The product name is a unique value, and it is possible to create unlimited products that will be distinct from each other.

There are five different methods that can be used on products.

1. [Create Product](#post-v2-subscription-products)
2. [Update Product](#post-v2-subscription-products-productreferencecode)
3. [Get Product](#get-v2-subscription-products-productreferencecode)
4. [List Products](#get-v2-subscription-products)
5. [Delete Product](#delete-v2-subscription-products-productreferencecode)

{% hint style="info" %}
A product can be deleted only if it does not have an associated plan. If a product associated with a plan needs to be deleted, the associated plan must be deleted first.
{% endhint %}

## Create Product

> Creates a new subscription product. The Subscription API charges on a recurring basis according to pricing plans, and each plan is linked to at least one product. There is no limit on the number of products; a product can be created by providing only a name.

```json
{"openapi":"3.0.3","info":{"title":"Subscription Product","version":"1.0.0"},"tags":[{"name":"Subscription Product","description":"Subscription product management services."}],"servers":[{"url":"https://api.iyzipay.com","description":"iyzico API"}],"paths":{"/v2/subscription/products":{"post":{"summary":"Create Product","operationId":"createSubscriptionProduct","description":"Creates a new subscription product. The Subscription API charges on a recurring basis according to pricing plans, and each plan is linked to at least one product. There is no limit on the number of products; a product can be created by providing only a name.","tags":["Subscription Product"],"parameters":[{"$ref":"#/components/parameters/AuthHeader"},{"$ref":"#/components/parameters/ContentTypeHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionProductCreateRequest"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionProductCreateSuccess"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"parameters":{"AuthHeader":{"name":"Authorization","in":"header","required":true,"description":"Authorization header; a signed hash value that starts with **IYZWSv2** and is generated in Base64 format.","schema":{"type":"string"}},"ContentTypeHeader":{"name":"Content-Type","in":"header","required":true,"description":"Content type of the request body.","schema":{"type":"string"}}},"schemas":{"SubscriptionProductCreateRequest":{"type":"object","properties":{"locale":{"type":"string","description":"Language of iyzico response messages. Default **en**; **tr** is supported."},"conversationId":{"type":"string","description":"A reference value that can be used to match request and response."},"name":{"type":"string","description":"Product name."},"description":{"type":"string","description":"Product description."}},"required":["name"]},"SubscriptionProductCreateSuccess":{"type":"object","properties":{"status":{"type":"string","description":"Operation result.","enum":["success","failure"]},"systemTime":{"type":"integer","description":"Operation time (epoch ms)."},"data":{"$ref":"#/components/schemas/ProductResource"}}},"ProductResource":{"type":"object","description":"Product details.","properties":{"referenceCode":{"type":"string","description":"Unique reference code of the product."},"createdDate":{"type":"string","description":"Product creation date (`YYYY-MM-DD hh:mm:ss`)."},"name":{"type":"string","description":"Product name."},"description":{"type":"string","description":"Product description."},"status":{"type":"string","description":"Product status (default ACTIVE)."},"pricingPlans":{"type":"array","description":"List of plans linked to the product.","items":{"$ref":"#/components/schemas/PricingPlanBrief"}}}},"PricingPlanBrief":{"type":"object","description":"Summary view of the plan linked to the product.","properties":{"referenceCode":{"type":"string","description":"Unique reference code of the plan."},"createdDate":{"type":"string","description":"Plan creation date (`YYYY-MM-DD hh:mm:ss`)."},"name":{"type":"string","description":"Plan name."},"price":{"type":"decimal","description":"Plan price (Decimal)."},"paymentInterval":{"type":"string","enum":["WEEKLY","MONTHLY","DAILY","YEARLY"],"description":"Payment frequency."},"paymentIntervalCount":{"type":"integer","description":"Number of repeats for the payment interval."},"trialPeriodDays":{"type":"integer","description":"Trial period (days)."},"currencyCode":{"type":"string","description":"Currency (e.g., TRY)."},"productReferenceCode":{"type":"string","description":"Reference code of the product the plan belongs to."},"planPaymentType":{"type":"string","description":"Plan payment type (RECURRING)."},"status":{"type":"string","description":"Plan status (e.g., ACTIVE)."},"recurrenceCount":{"type":"integer","description":"Total number of recurrences (if any)."}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","description":"Operation result.","enum":["success","failure"]},"errorCode":{"type":"string","description":"Error code."},"errorMessage":{"type":"string","description":"Error message."},"systemTime":{"type":"integer","description":"Operation time (epoch ms)."}}}}}}
```

#### Sample Codes

<table data-view="cards"><thead><tr><th></th></tr></thead><tbody><tr><td><a href="https://github.com/iyzico/iyzipay-php/blob/master/samples/subscription-samples/create_product.php">PHP</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-java/blob/master/src/test/java/com/iyzipay/sample/subscription/SubscriptionProductSample.java#L18">Java</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-dotnet/blob/master/Iyzipay.Samples/SubscriptionProductSample.cs#L13">.Net</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-node/blob/master/samples/IyzipaySubscriptionSamples.js#L16">Node.Js</a></td></tr><tr><td><a href="https://www.postman.com/iyzico/iyzico/request/85w60e9/1-1-create-product">Postman</a></td></tr></tbody></table>

## Update Product

> Updates a subscription product. Product name and description can be edited via API or the iyzico merchant panel. Use the product’s unique reference code for API updates.

```json
{"openapi":"3.0.3","info":{"title":"Subscription Product","version":"1.0.0"},"tags":[{"name":"Subscription Product","description":"Subscription product management services."}],"servers":[{"url":"https://api.iyzipay.com","description":"iyzico API"}],"paths":{"/v2/subscription/products/{productReferenceCode}":{"post":{"summary":"Update Product","operationId":"updateSubscriptionProduct","description":"Updates a subscription product. Product name and description can be edited via API or the iyzico merchant panel. Use the product’s unique reference code for API updates.","tags":["Subscription Product"],"parameters":[{"$ref":"#/components/parameters/AuthHeader"},{"$ref":"#/components/parameters/ContentTypeHeader"},{"name":"productReferenceCode","in":"path","required":true,"schema":{"type":"string"},"description":"Unique reference code of the product."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionProductUpdateRequest"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionProductGetSuccess"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"parameters":{"AuthHeader":{"name":"Authorization","in":"header","required":true,"description":"Authorization header; a signed hash value that starts with **IYZWSv2** and is generated in Base64 format.","schema":{"type":"string"}},"ContentTypeHeader":{"name":"Content-Type","in":"header","required":true,"description":"Content type of the request body.","schema":{"type":"string"}}},"schemas":{"SubscriptionProductUpdateRequest":{"type":"object","properties":{"locale":{"type":"string","description":"Response language (**en**/**tr**)."},"conversationId":{"type":"string","description":"Value used for request/response matching."},"name":{"type":"string","description":"New product name."},"description":{"type":"string","description":"New product description."}},"required":["name"]},"SubscriptionProductGetSuccess":{"type":"object","properties":{"status":{"type":"string","description":"Operation result.","enum":["success","failure"]},"systemTime":{"type":"integer","description":"Operation time (epoch ms)."},"data":{"$ref":"#/components/schemas/ProductResource"}}},"ProductResource":{"type":"object","description":"Product details.","properties":{"referenceCode":{"type":"string","description":"Unique reference code of the product."},"createdDate":{"type":"string","description":"Product creation date (`YYYY-MM-DD hh:mm:ss`)."},"name":{"type":"string","description":"Product name."},"description":{"type":"string","description":"Product description."},"status":{"type":"string","description":"Product status (default ACTIVE)."},"pricingPlans":{"type":"array","description":"List of plans linked to the product.","items":{"$ref":"#/components/schemas/PricingPlanBrief"}}}},"PricingPlanBrief":{"type":"object","description":"Summary view of the plan linked to the product.","properties":{"referenceCode":{"type":"string","description":"Unique reference code of the plan."},"createdDate":{"type":"string","description":"Plan creation date (`YYYY-MM-DD hh:mm:ss`)."},"name":{"type":"string","description":"Plan name."},"price":{"type":"decimal","description":"Plan price (Decimal)."},"paymentInterval":{"type":"string","enum":["WEEKLY","MONTHLY","DAILY","YEARLY"],"description":"Payment frequency."},"paymentIntervalCount":{"type":"integer","description":"Number of repeats for the payment interval."},"trialPeriodDays":{"type":"integer","description":"Trial period (days)."},"currencyCode":{"type":"string","description":"Currency (e.g., TRY)."},"productReferenceCode":{"type":"string","description":"Reference code of the product the plan belongs to."},"planPaymentType":{"type":"string","description":"Plan payment type (RECURRING)."},"status":{"type":"string","description":"Plan status (e.g., ACTIVE)."},"recurrenceCount":{"type":"integer","description":"Total number of recurrences (if any)."}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","description":"Operation result.","enum":["success","failure"]},"errorCode":{"type":"string","description":"Error code."},"errorMessage":{"type":"string","description":"Error message."},"systemTime":{"type":"integer","description":"Operation time (epoch ms)."}}}}}}
```

#### Sample Codes

<table data-view="cards"><thead><tr><th></th></tr></thead><tbody><tr><td><a href="https://github.com/iyzico/iyzipay-php/blob/master/samples/subscription-samples/update_product.php">PHP</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-java/blob/master/src/test/java/com/iyzipay/sample/subscription/SubscriptionProductSample.java#L36">Java</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-dotnet/blob/master/Iyzipay.Samples/SubscriptionProductSample.cs#L36">.Net</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-node/blob/master/samples/IyzipaySubscriptionSamples.js#L32">Node.js</a></td></tr><tr><td><a href="https://www.postman.com/iyzico/iyzico/request/3l501m2/1-4-update-product">Postman</a></td></tr></tbody></table>

## Get Product

> Retrieves details of a single product. Provide the product reference code in the request.

```json
{"openapi":"3.0.3","info":{"title":"Subscription Product","version":"1.0.0"},"tags":[{"name":"Subscription Product","description":"Subscription product management services."}],"servers":[{"url":"https://api.iyzipay.com","description":"iyzico API"}],"paths":{"/v2/subscription/products/{productReferenceCode}":{"get":{"summary":"Get Product","operationId":"getSubscriptionProduct","description":"Retrieves details of a single product. Provide the product reference code in the request.","tags":["Subscription Product"],"parameters":[{"$ref":"#/components/parameters/AuthHeader"},{"$ref":"#/components/parameters/ContentTypeHeader"},{"name":"productReferenceCode","in":"path","required":true,"schema":{"type":"string"},"description":"Unique reference code of the product."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionProductGetSuccess"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"parameters":{"AuthHeader":{"name":"Authorization","in":"header","required":true,"description":"Authorization header; a signed hash value that starts with **IYZWSv2** and is generated in Base64 format.","schema":{"type":"string"}},"ContentTypeHeader":{"name":"Content-Type","in":"header","required":true,"description":"Content type of the request body.","schema":{"type":"string"}}},"schemas":{"SubscriptionProductGetSuccess":{"type":"object","properties":{"status":{"type":"string","description":"Operation result.","enum":["success","failure"]},"systemTime":{"type":"integer","description":"Operation time (epoch ms)."},"data":{"$ref":"#/components/schemas/ProductResource"}}},"ProductResource":{"type":"object","description":"Product details.","properties":{"referenceCode":{"type":"string","description":"Unique reference code of the product."},"createdDate":{"type":"string","description":"Product creation date (`YYYY-MM-DD hh:mm:ss`)."},"name":{"type":"string","description":"Product name."},"description":{"type":"string","description":"Product description."},"status":{"type":"string","description":"Product status (default ACTIVE)."},"pricingPlans":{"type":"array","description":"List of plans linked to the product.","items":{"$ref":"#/components/schemas/PricingPlanBrief"}}}},"PricingPlanBrief":{"type":"object","description":"Summary view of the plan linked to the product.","properties":{"referenceCode":{"type":"string","description":"Unique reference code of the plan."},"createdDate":{"type":"string","description":"Plan creation date (`YYYY-MM-DD hh:mm:ss`)."},"name":{"type":"string","description":"Plan name."},"price":{"type":"decimal","description":"Plan price (Decimal)."},"paymentInterval":{"type":"string","enum":["WEEKLY","MONTHLY","DAILY","YEARLY"],"description":"Payment frequency."},"paymentIntervalCount":{"type":"integer","description":"Number of repeats for the payment interval."},"trialPeriodDays":{"type":"integer","description":"Trial period (days)."},"currencyCode":{"type":"string","description":"Currency (e.g., TRY)."},"productReferenceCode":{"type":"string","description":"Reference code of the product the plan belongs to."},"planPaymentType":{"type":"string","description":"Plan payment type (RECURRING)."},"status":{"type":"string","description":"Plan status (e.g., ACTIVE)."},"recurrenceCount":{"type":"integer","description":"Total number of recurrences (if any)."}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","description":"Operation result.","enum":["success","failure"]},"errorCode":{"type":"string","description":"Error code."},"errorMessage":{"type":"string","description":"Error message."},"systemTime":{"type":"integer","description":"Operation time (epoch ms)."}}}}}}
```

#### Sample Codes

<table data-view="cards"><thead><tr><th></th></tr></thead><tbody><tr><td><a href="https://github.com/iyzico/iyzipay-php/blob/master/samples/subscription-samples/retrieve_product.php">PHP</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-java/blob/master/src/test/java/com/iyzipay/sample/subscription/SubscriptionProductSample.java#L54">Java</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-dotnet/blob/master/Iyzipay.Samples/SubscriptionProductSample.cs#L78">.Net</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-node/blob/master/samples/IyzipaySubscriptionSamples.js#L58">Node.Js</a></td></tr><tr><td><a href="https://www.postman.com/iyzico/iyzico/request/5jm9v3w/1-3-retrieve-product">Postman</a></td></tr></tbody></table>

## List Products

> Lists subscription products. Use this to fetch all products and their linked plans. To reduce latency and payload size, pagination is used so you can retrieve the product list page by page.

```json
{"openapi":"3.0.3","info":{"title":"Subscription Product","version":"1.0.0"},"tags":[{"name":"Subscription Product","description":"Subscription product management services."}],"servers":[{"url":"https://api.iyzipay.com","description":"iyzico API"}],"paths":{"/v2/subscription/products":{"get":{"summary":"List Products","operationId":"listSubscriptionProducts","description":"Lists subscription products. Use this to fetch all products and their linked plans. To reduce latency and payload size, pagination is used so you can retrieve the product list page by page.","tags":["Subscription Product"],"parameters":[{"$ref":"#/components/parameters/AuthHeader"},{"$ref":"#/components/parameters/ContentTypeHeader"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionProductListRequest"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionProductListSuccess"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"parameters":{"AuthHeader":{"name":"Authorization","in":"header","required":true,"description":"Authorization header; a signed hash value that starts with **IYZWSv2** and is generated in Base64 format.","schema":{"type":"string"}},"ContentTypeHeader":{"name":"Content-Type","in":"header","required":true,"description":"Content type of the request body.","schema":{"type":"string"}}},"schemas":{"SubscriptionProductListRequest":{"type":"object","properties":{"page":{"type":"integer","description":"Returns products for the specified page."},"count":{"type":"integer","description":"Number of products per page."}}},"SubscriptionProductListSuccess":{"type":"object","properties":{"status":{"type":"string","description":"Operation result.","enum":["success","failure"]},"systemTime":{"type":"integer","description":"Operation time (epoch ms)."},"data":{"type":"object","description":"Pagination results.","properties":{"totalCount":{"type":"string","description":"Total number of results returned."},"currentPage":{"type":"integer","description":"Page number returned."},"pageCount":{"type":"integer","description":"Total page count."},"items":{"type":"array","description":"Product list.","items":{"$ref":"#/components/schemas/ProductResource"}}}}}},"ProductResource":{"type":"object","description":"Product details.","properties":{"referenceCode":{"type":"string","description":"Unique reference code of the product."},"createdDate":{"type":"string","description":"Product creation date (`YYYY-MM-DD hh:mm:ss`)."},"name":{"type":"string","description":"Product name."},"description":{"type":"string","description":"Product description."},"status":{"type":"string","description":"Product status (default ACTIVE)."},"pricingPlans":{"type":"array","description":"List of plans linked to the product.","items":{"$ref":"#/components/schemas/PricingPlanBrief"}}}},"PricingPlanBrief":{"type":"object","description":"Summary view of the plan linked to the product.","properties":{"referenceCode":{"type":"string","description":"Unique reference code of the plan."},"createdDate":{"type":"string","description":"Plan creation date (`YYYY-MM-DD hh:mm:ss`)."},"name":{"type":"string","description":"Plan name."},"price":{"type":"decimal","description":"Plan price (Decimal)."},"paymentInterval":{"type":"string","enum":["WEEKLY","MONTHLY","DAILY","YEARLY"],"description":"Payment frequency."},"paymentIntervalCount":{"type":"integer","description":"Number of repeats for the payment interval."},"trialPeriodDays":{"type":"integer","description":"Trial period (days)."},"currencyCode":{"type":"string","description":"Currency (e.g., TRY)."},"productReferenceCode":{"type":"string","description":"Reference code of the product the plan belongs to."},"planPaymentType":{"type":"string","description":"Plan payment type (RECURRING)."},"status":{"type":"string","description":"Plan status (e.g., ACTIVE)."},"recurrenceCount":{"type":"integer","description":"Total number of recurrences (if any)."}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","description":"Operation result.","enum":["success","failure"]},"errorCode":{"type":"string","description":"Error code."},"errorMessage":{"type":"string","description":"Error message."},"systemTime":{"type":"integer","description":"Operation time (epoch ms)."}}}}}}
```

#### Sample Codes

<table data-view="cards"><thead><tr><th></th></tr></thead><tbody><tr><td><a href="https://github.com/iyzico/iyzipay-php/blob/master/samples/subscription-samples/list_products.php">PHP</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-java/blob/master/src/test/java/com/iyzipay/sample/subscription/SubscriptionProductListSample.java">Java</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-dotnet/blob/master/Iyzipay.Samples/SubscriptionProductSample.cs#L98">.Net</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-node/blob/master/samples/IyzipaySubscriptionSamples.js#L69">Node.Js</a></td></tr><tr><td><a href="https://www.postman.com/iyzico/iyzico/request/227m43b/1-2-list-products">Postman</a></td></tr></tbody></table>

## Delete Product

> Deletes a subscription product. Products can be deleted via API or the iyzico merchant panel only when there are no plans linked to the product.

```json
{"openapi":"3.0.3","info":{"title":"Subscription Product","version":"1.0.0"},"tags":[{"name":"Subscription Product","description":"Subscription product management services."}],"servers":[{"url":"https://api.iyzipay.com","description":"iyzico API"}],"paths":{"/v2/subscription/products/{productReferenceCode}":{"delete":{"summary":"Delete Product","operationId":"deleteSubscriptionProduct","description":"Deletes a subscription product. Products can be deleted via API or the iyzico merchant panel only when there are no plans linked to the product.","tags":["Subscription Product"],"parameters":[{"$ref":"#/components/parameters/AuthHeader"},{"$ref":"#/components/parameters/ContentTypeHeader"},{"name":"productReferenceCode","in":"path","required":true,"schema":{"type":"string"},"description":"Unique reference code of the product."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionProductDeleteSuccess"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"parameters":{"AuthHeader":{"name":"Authorization","in":"header","required":true,"description":"Authorization header; a signed hash value that starts with **IYZWSv2** and is generated in Base64 format.","schema":{"type":"string"}},"ContentTypeHeader":{"name":"Content-Type","in":"header","required":true,"description":"Content type of the request body.","schema":{"type":"string"}}},"schemas":{"SubscriptionProductDeleteSuccess":{"type":"object","properties":{"status":{"type":"string","description":"Operation result.","enum":["success","failure"]},"systemTime":{"type":"integer","description":"Operation time (epoch ms)."}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string","description":"Operation result.","enum":["success","failure"]},"errorCode":{"type":"string","description":"Error code."},"errorMessage":{"type":"string","description":"Error message."},"systemTime":{"type":"integer","description":"Operation time (epoch ms)."}}}}}}
```

#### Sample Codes

<table data-view="cards"><thead><tr><th></th></tr></thead><tbody><tr><td><a href="https://github.com/iyzico/iyzipay-php/blob/master/samples/subscription-samples/delete_product.php">PHP</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-java/blob/master/src/test/java/com/iyzipay/sample/subscription/SubscriptionProductSample.java#L61">Java</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-dotnet/blob/master/Iyzipay.Samples/SubscriptionProductSample.cs#L60">.Net</a></td></tr><tr><td><a href="https://github.com/iyzico/iyzipay-node/blob/master/samples/IyzipaySubscriptionSamples.js#L47">Node.Js</a></td></tr><tr><td><a href="https://www.postman.com/iyzico/iyzico/request/47010871-0a348c6b-e48b-4c6e-9511-ca8992041cb6?tab=overview">Postman</a></td></tr></tbody></table>
