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.

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.

Create Product

The Subscription API collects recurring payments based on payment plans, and each payment plan is associated with at least one product. There are no limitations on the number of products, and a product can be created simply by sending the name information.

Create Product

POST https://api.iyzipay.com/v2/subscription/products

Request Body

Name
Type
Description

locale

String

It is used to set the language of the text returned as a result of the iyzico request. The default value is tr.

name*

String

Product name. It must be a unique name. An existing name cannot be given to another product

conversationId

String

It is a value that you can send during the request and receive in the response, used to match the request and response. The most common usage is the product number of the merchant

Description

String

Product description. This description can be shown to customers or it can be a note on your side.

{
    "status": "success",
    "systemTime": 1686785492734,
    "data": {
        "referenceCode": "ac3afdd2-69af-4ca6-a284-46bf8540a954",
        "createdDate": 1686785492730,
        "name": "Product Name",
        "description": "Product Description",
        "status": "ACTIVE",
        "pricingPlans": []
    }
}

Create Product Response;

Parameter Name
Type
Description

status

String

It indicates the result of the request. If the transaction is successful, it returns a 'success' value

systemTime

Long

The returned result is the current Unix timestamp value at that moment.

referenceCode

String

It is a unique reference code for the created product. It is used to update or delete a product, view product details, and create a plan for the product.

createdDate

Long

Date of product creation

name

String

Name of product

description

String

Product description. If it was sent during the request, this information is returned in the response.

pricingPlans

Array

It shows the plans associated with the product. It comes empty when the product is created as there are no plans associated with it at that time

Create Product Sample Codes

$request = new \Iyzipay\Request\Subscription\SubscriptionCreateProductRequest();
$request->setLocale("tr");
$request->setConversationId("1234567889");
$request->setName("KingOfProduct");
$request->setDescription("DescriptionOfProduct");

$result = \Iyzipay\Model\Subscription\SubscriptionProduct::create($request,Config::options());

Update Product

Update Product

POST https://api.iyzipay.com/v2/subscription/products/{reference_code}

Request Body

Name
Type
Description

productReferenceCode*

String

It is a unique reference code for the created product. It is used to update or delete a product, view product details, and create a plan for the product.

locale

String

It is used to set the language of the text returned as a result of the iyzico request. The default value is tr.

Description

String

Product description. This description can be shown to customers or it can be a note on your side.

name*

String

Product name. It must be a unique name. An existing name cannot be given to another product

{
    "status": "success",
    "systemTime": 1686786694036,
    "data": {
        "referenceCode": "561d57c4-6db8-437d-86a7-a12af6b47a7d",
        "createdDate": 1686786574621,
        "name": "New Product Name",
        "description": "New Product Description",
        "status": "ACTIVE",
        "pricingPlans": []
    }
}

Update Product Response;

Parameter Name
Type
Description

status

String

It indicates the result of the request. If the transaction is successful, it returns a 'success' value

systemTime

Long

The returned result is the current Unix timestamp value at that moment.

data.referenceCode

String

It is a unique reference code for the created product. It is used to update or delete a product, view product details, and create a plan for the product.

data.createdDate

Long

Date of product creation.

data.name

String

Name of product.

data.description

String

Product description. If it was sent during the request, this information is returned in the response.

data.status

String

It indicates the status of the product. The default is ACTIVE.

data.pricingPlans

Array

It displays the plans associated with the product.

Update Product Sample Codes;

$request = new \Iyzipay\Request\Subscription\SubscriptionUpdateProductRequest();
$request->setLocale("tr");
$request->setConversationId("1234567889");
$request->setProductReferenceCode("bbab6ca0-9054-45c7-8060-57a417167738");
$request->setName("newName");
$request->setDescription("newDescription");
$result = \Iyzipay\Model\Subscription\SubscriptionProduct::update($request,Config::options());

Delete Product

Products can be deleted both through the API and the iyzico merchant panel as long as there are no associated plans with them.

Delete Product

DELETE https://api.iyzipay.com/v2/subscription/products/{reference_code}

Request Body

Name
Type
Description

productReferenceCode*

String

Unique reference code for the product.

{
    "status": "success",
    "systemTime": 1686862271881
}

Delete Product Response;

Parameter Name
Type
Description

status

String

It indicates the result of the request. If the transaction is successful, it returns a 'success' value

systemTime

Long

The returned result is the current Unix timestamp value at that moment.

Get Product

Product details can be accessed through an API request. To do this, it is sufficient to specify the product reference code in the request.

Get Product

GET https://api.iyzipay.com/v2/subscription/products/{reference_code}

Request Body

Name
Type
Description

productReferenceCode*

String

Unique reference code for the product.

{
    "status": "success",
    "systemTime": 1686863264574,
    "data": {
        "referenceCode": "235dbc68-d281-4626-9c85-98002e558ce7",
        "createdDate": 1675684451778,
        "name": "test",
        "status": "ACTIVE",
        "pricingPlans": [
            {
                "referenceCode": "a3dde7ac-dff4-4d96-a6da-5780aeee9c9a",
                "createdDate": 1675684471828,
                "name": "testop",
                "price": 100.00000000,
                "paymentInterval": "MONTHLY",
                "paymentIntervalCount": 1,
                "trialPeriodDays": 0,
                "currencyCode": "TRY",
                "productReferenceCode": "235dbc68-d281-4626-9c85-98002e558ce7",
                "planPaymentType": "RECURRING",
                "status": "ACTIVE"
            }
        ]
    }
}

Get Product Response;

Parametre ismi
Tip
Açıklama

status

String

It indicates the result of the request. If the transaction is successful, it returns a 'success' value

systemTime

Long

The returned result is the current Unix timestamp value at that moment.

data.referenceCode

String

Unique reference code for the product.

data.createdDate

Long

Date of product creation.

data.name

String

Name of product.

data.description

String

Product description. If it was sent during the request, this information is returned in the response.

data.status

String

It indicates the status of the product. The default is ACTIVE.

data.pricingPlans

Array

It displays the plans associated with the product.

List Products

The product listing is used to access all products and plans associated with the products. The paging method is used to shorten response time and reduce response size. This allows you to quickly retrieve the list of products page by page.

List Products

GET https://api.iyzipay.com/v2/subscription/products

Request Body

Name
Type
Description

page*

Integer

It retrieves all the products for the specified page.

count*

Integer

It specifies how many products will be listed per page

{
    "status": "success",
    "systemTime": 1686862833975,
    "data": {
        "totalCount": 5,
        "currentPage": 1,
        "pageCount": 1,
        "items": [
            {
                "referenceCode": "235dbc68-d281-4626-9c85-98002e558ce7",
                "createdDate": 1675684451778,
                "name": "test",
                "status": "ACTIVE",
                "pricingPlans": [
                    {
                        "referenceCode": "a3dde7ac-dff4-4d96-a6da-5780aeee9c9a",
                        "createdDate": 1675684471828,
                        "name": "testop",
                        "price": 100.00000000,
                        "paymentInterval": "MONTHLY",
                        "paymentIntervalCount": 1,
                        "trialPeriodDays": 0,
                        "currencyCode": "TRY",
                        "productReferenceCode": "235dbc68-d281-4626-9c85-98002e558ce7",
                        "planPaymentType": "RECURRING",
                        "status": "ACTIVE"
                    }
                ]
            }
        ]
    }
}

List Products Response;

Parameter Name
Type
Description

status

String

It indicates the result of the request. If the transaction is successful, it returns a 'success' value

systemTime

Long

The returned result is the current Unix timestamp value at that moment.

data.totalCount

String

It indicates the total number of results.

data.currentPage

Integer

Hangi sayfa için listeleme yapıldığını belirtir.

data.pageCount

Integer

It specifies which page the listing is for.

data.items

Array Object

It is an array containing product details.

Last updated