Skip to main content

Update a subscription

Last updated: 28-Jan-2025
Rate this article:

Overview

Change specific details about a subscription. Use the updateSubscription method to change specific details about a subscription.

Parameters

Parameters 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.
Subscription Required (Object)
  You need to include the entire Subscription object keeping its structure unchanged (retrieve it using getSubscription) but you can update only specific parameters enumerated below.
  EndUser Object
    End user details.
  ExpirationDate String
   

Subscription expiration date - If you changed the time zone for the 2Checkout API by editing system settings under Account settings, then 2Checkout calculates the ExpirationDate according to your custom configuration. Note: The default 2Checkout API time zone is GMT+02:00.

You cannot set an expiration date from the past.

  ActivationDate String
   

Subscription activation date - If you changed the time zone for the 2Checkout API by editing system settings under Account settings, then 2Checkout calculates the ActivationDate according to your custom configuration. Note: The default 2Checkout API time zone is GMT+02:00

This field is optional. If provided, it cannot be set lower than the subscription start date (creation/purchase date) and it can be changed only while the subscription is in pending activation

  SubscriptionEnabled Boolean
    Possible values: TRUE/FALSE
  RecurringEnabled Boolean
    Possible values: TRUE/FALSE
  ExternalCustomerReference String
   

Unique customer alphanumeric (string) identifiers that you control. Use this to 

move a subscription from under a customer to another customer entity. 2Checkout moves subscription under the customer for which you provide the External customer reference during the subscription update process. View example.

  ProductId Int
   

System-generated unique product ID. Needs to be the ID of an existing product in the 2Checkout system created under your account.

The product ID governs the product to which the subscription is associated with.

Product types must match Regular - Regular or Bundle - Bundle.

IDs must identify products with the renewal system enabled (max billing cycle 36 months).

  ProductName String
    The name of the product for identifier used under ProductID.
  ProductQuantity Int
    Ordered quantity.
  PriceOptionCodes Array
   

Array of product options codes. Pricing options codes are case sensitive.

To impact the renewal price, the PriceOptionsCodes need to belong to price options of pricing configurations used for the product with which the subscription is associated.

ChurnReasons Array
 

This payload can be sent only when the Subscription object (from above) will have RecurringEnabled set as TRUE. Possible values for this field are:
CHURN_REASON_NOT_SATISFIED_PRODUCT

CHURN_REASON_ENABLED_BY_MISTAKE

CHURN_REASON_PREFER_MANUAL

CHURN_REASON_ALREADY_RENEWED

CHURN_REASON_DONT_NEED

CHURN_REASON_WANT_PAUSE

CHURN_REASON_COVID

CHURN_REASON_HIGH_PRICE

CHURN_REASON_NOT_SATISFIED_SUPPORT

CHURN_REASON_EXTRAORDINARY

CHURN_REASON_OTHER

ChurnReasonOther String
  This field should have a value only if the ChurnReasons has the CHURN_REASON_EXTRAORDINARY or CHURN_REASON_OTHER values

 

All other parameters of the Subscription object are non-editable.

The 2Checkout system uses the updated subscription information for:

  • Manual and automatic renewals
  • Upgrades
  • Trial conversions

Response

Parameters Type/Description
Boolean true or false depending on whether the changes were successful or not.

Request

<?php

require ('PATH_TO_AUTH');

$subscriptionReferenceTest = 'YOUR_SUBSCRIPTION_REFERENCE';

$jsonRpcRequest = array (
'method' => 'getSubscription',
'params' => array($sessionID, $subscriptionReferenceTest),
'id' => $i++,
'jsonrpc' => '2.0');

$updatedSubscription = callRPC((Object)$jsonRpcRequest, $host, true);
var_dump ($updatedSubscription);
$updatedSubscription->RecurringEnabled = false;
$updatedSubscription->SubscriptionEnabled = true;
$updatedSubscription->ExpirationDate = '2020-12-12';

$jsonRpcRequest = array (
'method' => 'updateSubscription',
'params' => array($sessionID, $updatedSubscription),
'id' => $i++,
'jsonrpc' => '2.0');

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

 

Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo