> For the complete documentation index, see [llms.txt](https://docs.2checkout.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.2checkout.com/soap-api-reference/soap-api-6.0/api-requests/product/add-product.md).

# Add product

Use the **addProduct** method to create subscription plans/products for your 2Checkout account.

## Request parameters

<table><thead><tr><th width="115.86669921875">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>sessionID</code></td><td><strong>Required (string)</strong><br>Session identifier, the output of the <strong>Login</strong> method. Include <code>sessionID</code> into all your requests. 2Checkout throws an exception if the values are incorrect. The <code>sessionID</code> expires in <strong>10 minutes</strong>.</td></tr><tr><td><a href="/pages/JxBhbjWQD3BHLrSLRyGv"><code>Product</code></a></td><td><strong>Required (object)</strong><br>Use this object to configure your subscription plans/products.<br>You can set all <code>Product</code> parameters except <code>AvangateID and GroupName</code>. The 2Checkout system sets the unique <strong>product ID</strong>. The <strong>AvangateID</strong> and <strong>GroupName</strong> are not editable.</td></tr></tbody></table>

### Request sample

```php
<?php

declare(strict_types=1);

class Configuration
{
    public const MERCHANT_CODE = '';
    public const MERCHANT_KEY = '';
    public const URL = 'http://api.2checkout.com/soap/6.0';
    public const ACTION = 'addProduct';
    public const ADDITIONAL_OPTIONS = null;
    //array or JSON
    public const PAYLOAD = <<<JSON
{
  "AvangateId": null,
  "Enabled": true,
  "GeneratesSubscription": true,
  "GiftOption": false,
  "LongDescription": "Some long description",
  "ProductCode": "API_Imported_Product_1",
  "ProductGroupCode": "9652CDA441",
  "TaxCategory": "5db74b57-98a5-4fc1-b559-aee8eba3f046",
  "Tangible": 0,
  "Fulfillment": "",
  "Platforms": [\
    {\
      "Category": "Mobile",\
      "IdPlatform": "23",\
      "PlatformName": "Android"\
    },\
    {\
      "Category": "Mobile",\
      "IdPlatform": "20",\
      "PlatformName": "iPhone"\
    },\
    {\
      "Category": "Desktop",\
      "IdPlatform": "32",\
      "PlatformName": "Windows 10"\
    }\
  ],
  "Prices": [],
  "PricingConfigurations": [\
    {\
      "BillingCountries": [],\
      "Code": "54DCBC3DC8",\
      "Default": true,\
      "DefaultCurrency": "USD",\
      "Name": "2Checkout Subscription's Price Configuration Marius",\
      "PriceOptions": [\
        {\
          "Code": "SUPPORT",\
          "Required": true\
        },\
        {\
          "Code": "USERS",\
          "Required": true\
        },\
        {\
          "Code": "BACKUP",\
          "Required": false\
        }\
      ],\
      "PriceType": "NET",\
      "Prices": {\
        "Regular": [\
          {\
            "Amount": 99,\
            "Currency": "USD",\
            "MaxQuantity": "99999",\
            "MinQuantity": "1",\
            "OptionCodes": []\
          },\
          {\
            "Amount": 0,\
            "Currency": "EUR",\
            "MaxQuantity": "99999",\
            "MinQuantity": "1",\
            "OptionCodes": []\
          }\
        ],\
        "Renewal": []\
      },\
      "PricingSchema": "DYNAMIC"\
    }\
  ],
  "ProductCategory": "Audio & Video",
  "ProductImages": [\
    {\
      "Default": true,\
      "URL": "https://store.avancart.com/images/merchant/ef0b9a69f90b1ab0228784ccc7d52136/products/box-2.jpg"\
    }\
  ],
  "ProductName": "Product Name 01",
  "ProductType": "REGULAR",
  "ProductVersion": "1.0",
  "PurchaseMultipleUnits": true,

  "ShortDescription": "some short description",
  "SubscriptionInformation": {
    "BillingCycle": "1",
    "BillingCycleUnits": "M",
    "BundleRenewalManagement": "GLOBAL",
    "ContractPeriod": {
      "Action": "RESTART",
      "EmailsDuringContract": true,
      "IsUnlimited": true,
      "Period": -1,
      "PeriodUnits": "D"
    },
    "DeprecatedProducts": [],
    "GracePeriod": {
      "IsUnlimited": false,
      "Period": "7",
      "PeriodUnits": "D",
      "Type": "CUSTOM"
    },
    "IsOneTimeFee": false,
    "RenewalEmails": {
      "Settings": {
        "AutomaticRenewal": {
          "After15Days": false,
          "After5Days": false,
          "Before15Days": false,
          "Before1Day": false,
          "Before30Days": false,
          "Before7Days": true,
          "OnExpirationDate": true
        },
        "ManualRenewal": {
          "After15Days": false,
          "After5Days": false,
          "Before15Days": false,
          "Before1Day": false,
          "Before30Days": false,
          "Before7Days": true,
          "OnExpirationDate": true
        }
      },
      "Type": "CUSTOM"
    },
    "UsageBilling": 0
  },
  "SystemRequirements": "",
  "Translations": [\
    {\
      "Description": "some description",\
      "Language": "ZH",\
      "LongDescription": "some long description",\
      "Name": "some name",\
      "SystemRequirements": "",\
      "TrialUrl": "url",\
      "TrialDescription": "TrialDescription"\
    }\
  ],
  "TrialDescription": "",
  "TrialUrl": ""
}
JSON;
}

class Client
{
    public function call(
        string $url = Configuration::URL,
        $payload = Configuration::PAYLOAD,
        string $action = Configuration::ACTION
    ): ?object
    {
        if (is_array($payload)) {
            $payload = json_encode($payload);
        }
        if (!empty($payload)) {
            // SoapClient works with objects(StdClass)
            $payload = json_decode($payload);
        }
        $soapClient = $this->getClient($url);
        $sessionId = $this->getSession($soapClient);
        $args = array_filter([$sessionId, $payload]);
        return $soapClient->$action(...$args);
    }

    public function getClient(string $url): SoapClient
    {
        return new SoapClient(
            $url . '?wsdl',
            [\
                'location' => $url,\
                'cache_wsdl' => WSDL_CACHE_NONE,\
            ]
        );
    }

    public function getSession(SoapClient $client)
    {
        $date = gmdate('Y-m-d H:i:s');
        $merchantCode = Configuration::MERCHANT_CODE;
        $key = Configuration::MERCHANT_KEY;
        $string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
        $hash = hash_hmac('md5', $string, $key);
       // $client->__setCookie('XDEBUG_SESSION', 'PHPSTORM');
        return $client->login($merchantCode, $date, $hash);
    }
}

try {
    $client = new Client();
    var_dump($client->call());
} catch (Exception $ex) {
    var_dump($ex);
}
```

## Response

```php
bool(true)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.2checkout.com/soap-api-reference/soap-api-6.0/api-requests/product/add-product.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
