# Set grace period

Use the **setSubscriptionGracePeriod** method to set a custom grace period for an Active or Past Due subscription. This method changes per-subscription end user data and not customer details.

## Request parameters

<table><thead><tr><th width="223.5999755859375">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>sessionID</code></td><td><p><strong>Required (string)</strong></p><p>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>.</p></td></tr><tr><td><code>subscriptionReference</code></td><td><p><strong>Required (string)</strong></p><p>Unique, system-generated subscription identifier. Needs to belong to an <strong>Active</strong> or <strong>Past Due subscription</strong>.</p></td></tr><tr><td><code>subscriptionGracePeriod</code></td><td><p><strong>Required (int)</strong></p><p>The number of days for the grace period, during which time, customers can still renew/upgrade expired subscriptions. During the grace period, subscriptions feature the <strong>Past Due</strong> status. Can be NULL. When NULL, the grace period for a subscription is the same as that you defined in the per-product or per-account grace period settings. You can use this to set a custom grace period for a subscription. Use <strong>0</strong> to remove the grace period from a subscription.</p></td></tr></tbody></table>

### Request sample

```php
<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';
$gracePeriod = YOUR_GRACE_PERIOD;

$jsonRpcRequest = array (
  'method' => 'setSubscriptionGracePeriod',
  'params' => array($sessionID, $subscriptionReference, $gracePeriod),
  'id' => $i++,
  'jsonrpc' => '2.0');

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

## Response parameters

<table><thead><tr><th width="119.0667724609375">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 the changes were successful or not.</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/set-grace-period.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.
