Payment Plan

The subscription system operates by default according to the specified plan. The payment plan is the step where all the necessary features for recurring payments are specified.

Plans have unique names, and one plan can only be associated with one product. If a plan is actively linked to a subscription, it cannot be deleted.

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

Create Payment Plan

To create a plan, the following details must be provided: product reference number, name, price, currency, payment interval, and other parameters as detailed below.

If a trial period is desired for a subscription, the trialPeriodDays parameter can be used. If this parameter is sent, no subscription will be initiated and no payment will be collected from the card during the specified period.

The Payment Interval parameter specified in the request indicates the payment period. When sending the "WEEKLY" parameter when creating a plan, iyzico will deduct the specified amount from the card every week. Customizing this period is also possible. For example, if you want payments to be collected every 2 weeks, you should send the PaymentInterval value as "WEEKLY" and the paymentIntervalCount value as 2.

The planPaymentType parameter is mandatory and can currently only take the value RECURRING.

Create Payment Plan

POST https://api.iyzipay.com/v2/subscription/products/{product_reference}/pricing-plans

Request Body

{
    "status": "success",
    "systemTime": 1686865372192,
    "data": {
        "referenceCode": "fb4f08bb-b95b-44e8-a7f4-4111c0fa99d9",
        "createdDate": 1686865372183,
        "name": "Ödeme Planı",
        "price": 440.40,
        "paymentInterval": "MONTHLY",
        "paymentIntervalCount": 1,
        "trialPeriodDays": 0,
        "currencyCode": "TRY",
        "productReferenceCode": "235dbc68-d281-4626-9c85-98002e558ce7",
        "planPaymentType": "RECURRING",
        "status": "ACTIVE",
        "recurrenceCount": 12
    }
}

Create Payment Plan Response

Update Payment Plan

This method allows only the updating of the name and trialPeriodDays parameters. To update a plan, the unique reference code associated with that plan must be used. Updating can be done both through the API and the iyzico merchant panel.

Update Payment Plan

POST https://api.iyzipay.com/v2/subscription/pricing-plans/{pricingPlanReferenceCode}

Request Body

{
    "status": "success",
    "systemTime": 1686865996746,
    "data": {
        "referenceCode": "fb4f08bb-b95b-44e8-a7f4-4111c0fa99d9",
        "createdDate": 1686865372183,
        "name": "Update Plan",
        "price": 440.40000000,
        "paymentInterval": "MONTHLY",
        "paymentIntervalCount": 1,
        "trialPeriodDays": 10,
        "currencyCode": "TRY",
        "productReferenceCode": "235dbc68-d281-4626-9c85-98002e558ce7",
        "planPaymentType": "RECURRING",
        "status": "ACTIVE",
        "recurrenceCount": 12
    }
}

Update Payment Plan Response

Delete Payment Plan

A plan can only be deleted if it has no associated subscriptions. To delete a plan, the merchant must use the plan reference code. The request is responded to as either success or failure. Success means the plan has been successfully deleted.

Delete Payment Plan

DELETE https://api.iyzipay.com/v2/subscription/pricing-plans/{pricingPlanReferenceCode}

Request Body

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

Delete Payment Plan Response

Get Payment Plan

Merchant businesses can view all the details of a plan both through the merchant panel and via API requests.

Get Payment Plan

GET https://api.iyzipay.com/v2/subscription/pricing-plans/{pricingPlanReferenceCode}

Request Body

{
    "status": "success",
    "systemTime": 1686866781049,
    "data": {
        "referenceCode": "d507f394-5823-4260-b942-23782045eaac",
        "createdDate": 1686866768055,
        "name": "Ödeme Planı",
        "price": 440.40000000,
        "paymentInterval": "MONTHLY",
        "paymentIntervalCount": 1,
        "trialPeriodDays": 0,
        "currencyCode": "TRY",
        "productReferenceCode": "235dbc68-d281-4626-9c85-98002e558ce7",
        "planPaymentType": "RECURRING",
        "status": "ACTIVE",
        "recurrenceCount": 12
    }
}

Get Payment Plan Response

List of Payment Plans

All plans and the products they are associated with can be viewed in the response to this request. The response is sent in pages.

List of Payment Plans

GET https://api.iyzipay.com/v2/subscription/products/{product_reference}/pricing-plans

Request Body

{
    "status": "success",
    "systemTime": 1686867184729,
    "data": {
        "totalCount": 2,
        "currentPage": 1,
        "pageCount": 1,
        "items": [
            {
                "referenceCode": "d507f394-5823-4260-b942-23782045eaac",
                "createdDate": 1686866768055,
                "name": "Ödeme Planı",
                "price": 440.40000000,
                "paymentInterval": "MONTHLY",
                "paymentIntervalCount": 1,
                "trialPeriodDays": 0,
                "currencyCode": "TRY",
                "productReferenceCode": "235dbc68-d281-4626-9c85-98002e558ce7",
                "planPaymentType": "RECURRING",
                "status": "ACTIVE",
                "recurrenceCount": 12
            },
            {
                "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 of Payment Plan Response

Last updated