Upgrade subscription
Use the setSubscriptionUpgrade method to upgrade a subscription.
Requirements
You can only upgrade subscriptions with automatic renewal enabled.
The upgrade will not work if the subscription has a refund request that was not yet processed.
Request parameters
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.
productCode
Required (string) 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.
options
Optional (string) Pricing options of the target product for the subscription upgrade process. String - ';' separated list of 'OptionValue' returned by getProductUpgradeOptions function. If the pricing options groups is "scale" (interval), the Options parameter should be sent like this: [option group unique code] + "=" + value — e.g. Users=7
customPrice
Optional (string) The price you want to charge customers for the upgrade. The currency used by default is the same as in the previous payment customers made.
Response parameters
Boolean
true or false depending on whether or not the operation succeeded.
Request sample
<?php
require ('PATH_TO_AUTH');
$subscriptionReference = 'BE14FDCF37';
$ProductCode = 'my_subscription_123';
$Options = 'emailsupport;oneuser1';//case sensitive; include only price options codes (exclude spaces)
$customPrice = 1;
try {
$upgradedSubscriptions = $client->setSubscriptionUpgrade($sessionID, $subscriptionReference, $ProductCode, $Options, $customPrice);
}
catch (SoapFault $e) {
echo "upgradedSubscriptions: " . $e->getMessage();
exit;
}
var_dump("upgradedSubscriptions", $upgradedSubscriptions);Last updated
Was this helpful?