LogoLogo
GitHubFeedback Form
EN
EN
  • GETTING STARTED
    • Welcome
    • Preliminaries
      • Sandbox
      • Authentication
        • HMACSHA256 Auth
      • Postman Collections
      • Live vs Sandbox
      • Idempotency
      • Limiters
  • Payment Methods
    • PayWithiyzico (PWI)
      • PWI Implementation
        • PWI-Initialize
        • PWI-Retrieve
        • PWI Sample Imp.
    • Direct Charge
      • Non-3DS
        • NON-3DS Implementation
          • Create Payment
          • Retrieve
      • 3DS
        • 3DS Implementation
          • Init 3DS
          • Auth 3DS
      • Checkout Form (CF)
        • CF Implementation
          • CF-Initialize
          • CF-Retrieve
          • CF Sample Imp.
    • PreAuth & Capture
      • Non-3DS
        • Non-3DS Implementation
          • Create PreAuth Payment
          • Create PostAuth Payment
  • Products
    • Online Payment
    • Marketplace
      • Marketplace Implementation
        • Submerchant
          • Submerchant Update
          • Retrieve Submerchant
          • Submerchant Price / Item Update
        • Online Payment
        • Approval
    • Subscription
      • Subscription Implementation
        • Subscription Product
        • Payment Plan
        • Subscription Transactions
        • Subscriber Transactions
    • Bank Transfer
      • Bank Transfer Implementation
        • Bank Transfer Init
        • Bank Transfer Retrieve
      • Bank Transfer FAQ
    • iyzilink
      • iyzilink API
    • Shopping Credit
      • Shopping Credit Implementation
        • Initialize Shopping Credit
        • Retrieve Shopping Credit
        • Shopping Credit Sample Imp.
  • Advanced
    • Card Storage
    • Reporting Service
    • Refund & Cancel
    • Webhook
    • SFTP
    • Settlement Files
    • Fraud Notifications
    • Installment & BIN Service
    • Refund to Balance
    • Retrieve Payment
    • Response Signature Validation
  • Platforms
    • Woocommerce
    • Opencart
    • Prestashop
    • Magento
    • IdeaSoft
    • Ticimax
    • T-Soft
    • Shopify
    • WIX
  • Add-ons
    • Error Codes
      • Bank Error Codes
    • Test Cards
    • Integration Checklist
    • iyzico Logo Pack
Powered by GitBook
LogoLogo

Company

  • About
  • Career
  • Social
  • Youtube

Community

  • Github
  • Medium

Integration

  • Brand Guide
  • Solution Partners
  • Open Source

Contact

  • Contact Us
  • Support Center
On this page
  • Create Product
  • Create Product
  • Update Product
  • Update Product
  • Delete Product
  • Delete Product
  • Get Product
  • Get Product
  • List Products
  • List Products
  1. Products
  2. Subscription
  3. Subscription Implementation

Subscription Product

PreviousSubscription ImplementationNextPayment Plan

Last updated 1 year ago

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());
CreateProductRequest request = new CreateProductRequest
{
    Description = "product-description",
    Locale = Locale.TR.ToString(),
    Name = $"product-name-{randomString}",
    ConversationId = "123456789"
};

ResponseData<ProductResource> response = Product.Create(request, options);
CreateSubscriptionProductRequest createSubscriptionProductRequest = new CreateSubscriptionProductRequest();
createSubscriptionProductRequest.setName("customer-Caner-3");
createSubscriptionProductRequest.setDescription("product");
createSubscriptionProductRequest.setLocale(Locale.TR.name());
createSubscriptionProductRequest.setConversationId("12345678");

SubscriptionProduct response = SubscriptionProduct.create(createSubscriptionProductRequest, options);
//Request
{
    "locale": "tr",
    "conversationId": "123456789",
    "name": "Product Name",
    "description": "Product Description"
}

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

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());
UpdateProductRequest updateProductRequest = new UpdateProductRequest
{
    Description = "updated-description",
    Locale = Locale.TR.ToString(),
    Name = $"updated-product-name-{randomString}",
    ConversationId = "123456789",
    ProductReferenceCode = "productReferenceCode"
};

ResponseData<ProductResource> response = Product.Update(updateProductRequest, options);
SubscriptionUpdateProductRequest updateProductRequest = new SubscriptionUpdateProductRequest();
        updateProductRequest.setName("Caner-Product");
        updateProductRequest.setDescription("product");
        updateProductRequest.setLocale(Locale.TR.name());
        updateProductRequest.setConversationId("12346543");

        SubscriptionProduct response = SubscriptionProduct.update("c777b5b0-bc79-4f3f-ac1f-71c064990939", updateProductRequest, options);
//Request
{
    "locale": "tr",
    "productReferenceCode": "561d57c4-6db8-437d-86a7-a12af6b47a7d",
    "name": "New Product Name",
    "description": "New Product Description"
}

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

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.

Create Product
Update Product
Delete Product
Get Product
List Products