# Upgrade subscription

Use the **setSubscriptionUpgrade** method to upgrade a subscription.

## Requirements

You can only upgrade subscriptions with automatic renewal **enabled**.

{% hint style="warning" %}
The upgrade will not work if the subscription has a refund request that was not yet processed.
{% endhint %}

## Request parameters

<table><thead><tr><th width="215.066650390625">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><code>subscriptionReference</code></td><td><strong>Required (string)</strong><br>Unique, system-generated subscription identifier.</td></tr><tr><td><code>productCode</code></td><td><strong>Required (string)</strong><br>Unique identifier of the target product for the subscription upgrade process. You control the product code and can set it up in the Control Panel.</td></tr><tr><td><code>options</code></td><td><strong>Optional (string)</strong><br>Pricing options of the target product for the subscription upgrade process.<br>String — ';' separated list of <code>OptionValue</code> returned by <strong>getProductUpgradeOptions</strong> function.<br>If the pricing options groups is "scale" (interval), the Options parameter should be sent like this: [option group unique code] + "=" + value<br>e.g. Users=7</td></tr><tr><td><code>customPrice</code></td><td><strong>Optional (string)</strong><br>The price you want to charge customers for the upgrade. <strong>The currency used by default is the same as in the previous payment customers made.</strong></td></tr></tbody></table>

### Request sample

```php
<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';
$productCode = 'YOUR_PRODUCT_CODE';
$options = 'YOUR_PRICE_CODES'; //case sensitive; include only price options codes (exclude spaces)
$customPrice = 1;

$jsonRpcRequest = array (
  'method' => 'setSubscriptionUpgrade',
  'params' => array($sessionID, $subscriptionReference, $productCode, $options, $customPrice),
  'id' => $i++,
  'jsonrpc' => '2.0'
);

var_dump (callRPC((Object)$jsonRpcRequest, $host, true));
```

## Response parameters

<table><thead><tr><th width="110.5333251953125">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Boolean</strong></td><td><strong>true</strong> or <strong>false</strong> depending on whether or not the operation succeeded.</td></tr></tbody></table>


---

# Agent Instructions: 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:

```
GET https://docs.2checkout.com/json-rpc-api-reference/json-rpc-api-6.0/api-requests/subscription-upgrade/upgrade-subscription.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
