# Pause subscription

Use the **pauseSubscription** method to suspend all automatic charges for a predefined time period for a subscription.

## Request parameters

<table><thead><tr><th width="168.13330078125">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>SubscriptionRef</code></td><td><p><strong>Required (string)</strong></p><p>The system-generated reference code of the subscription.</p></td></tr><tr><td><code>ResumeDate</code></td><td><p><strong>Required (number)</strong></p><p>Date when the subscription should be resumed. Format "YYYY-MM-DD". The resume date needs to be set within 3 years starting from the day the subscription expires. The timezone used is the one on the server.</p></td></tr><tr><td><code>PauseReason</code></td><td><p><strong>Optional (string)</strong></p><p>Freeform text filled in by the merchant. Text is limited to 100 characters.</p></td></tr></tbody></table>

### Request sample

```php
<?php
$host = 'https://api.2checkout.com/rpc/6.0/';
$merchantCode = "666999";
$key = "%y~8|m]T84p[W4+O1]_?";
$string = strlen($merchantCode) . $merchantCode . strlen(gmdate('Y-m-d H:i:s')) . gmdate('Y-m-d H:i:s');
$hash = hash_hmac('md5', $string, $key);
$i = 1; // counter for api calls
// call login
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'login';
$jsonRpcRequest->params = array($merchantCode, gmdate('Y-m-d H:i:s'), $hash);
$jsonRpcRequest->id = $i++;
$sessionID = callRPC($jsonRpcRequest, $host);
var_dump("session id:" . $sessionID);
// call api methods below
$SubscriptionRef = 'B7D8E72224';
$jsonRpcRequest = array (
    'jsonrpc' => '2.0',
    'method' => 'setRenewalPause',
    'params' => array($sessionID, $SubscriptionRef, "2020-09-30 17:00:00", "vacation leave"),
    'id' => $i++
);
var_dump ("setRenewalPause", callRPC((Object)$jsonRpcRequest, $host));
$jsonRpcRequest = array (
    'jsonrpc' => '2.0',
    'method' => 'getRenewalPause',
    'params' => array($sessionID, $SubscriptionRef),
    'id' => $i++
);
var_dump ("getRenewalPause", callRPC((Object)$jsonRpcRequest, $host));
function callRPC($Request, $hostUrl, $Debug = false) {
    $curl = curl_init($hostUrl);
    curl_setopt( $curl, CURLOPT_POST, 1);
    curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt( $curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));
    $RequestString = json_encode($Request);
    curl_setopt( $curl, CURLOPT_POSTFIELDS, $RequestString);
    curl_setopt( $curl, CURLOPT_COOKIE, "XDEBUG_SESSION=PHPSTORM");
    if (stristr($hostUrl, 'sandboxdev') || stristr($hostUrl, 'git-sb')) {
        curl_setopt( $curl, CURLOPT_PROXY, 'localhost:3128');
        //  curl_setopt( $curl, CURLOPT_PROXY, 'proxy.avangate.local:8080');
        //  curl_setopt( $curl, CURLOPT_PROXYUSERPWD, 'andrei.avramica:pw'); // for authenticated proxies
    }
    $ResponseString = curl_exec ($curl);
    if (!empty($ResponseString)) {
        $Response = json_decode ($ResponseString,false);
        if (isset($Response->error) && !is_null($Response->error)) {
            var_dump($Response->error) ;
            return null;
        }
        return $Response->result;
    } else {
        return null;
    }
}
exit;
```

## Response parameters

The **pauseSubscription** call returns TRUE/FALSE parameters.

<table><thead><tr><th width="154.2667236328125">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>SubscriptionRef</code></td><td><p><strong>Boolean</strong></p><p>TRUE — if the call was successful and a pause was scheduled.</p><p>FALSE — if the pause mechanism is not enabled for the merchant OR any of the eligibility conditions were not met OR pause is not enabled for the product OR the maximum pause duration for the product was exceeded. In this case, the system also throws the following message: "The subscription is not eligible for pause."</p></td></tr><tr><td><code>ResumeDate</code></td><td><p><strong>Boolean</strong></p><p>TRUE — if the call was successful and a pause was scheduled.</p><p>FALSE — if the pause mechanism is not enabled for the merchant OR any of the eligibility conditions were not met OR pause is not enabled for the product OR the maximum pause duration for the product was exceeded. In this case, the system also throws the following message: "The subscription is not eligible for pause."</p></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/pause-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.
