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

{
    "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;

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

{
    "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;

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

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

Delete Product Response;

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

{
    "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;

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

{
    "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;

Last updated