For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

Parameter
Type / Description

sessionID

Required (string)

Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes.

subscriptionReference

Required (string)

Unique, system-generated subscription identifier. Needs to belong to an Active or Past Due subscription.

subscriptionGracePeriod

Required (int)

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 Past Due 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 0 to remove the grace period from a subscription.

Request sample

<?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

Type
Description

Boolean

true or false depending on whether the changes were successful or not.

Last updated

Was this helpful?