Dissociate an addon from a product
Use the dissociateAddon method to remove the association between an addon product and a regular product.
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.
ProductCode
Required (object)
The unique code of the regular product.
AddonCode
Required (object)
The unique code of the addon product.
Requirements
After the association is removed, the addon can no longer be purchased together with the regular product. Subscriptions that already include the addon are not deleted by this request.
Associations are removed one pair of products at a time.
Request sample
<?php
$vendorCode = 'YOUR_VENDOR_CODE';
$apiKey = 'YOUR_API_KEY';
$date = gmdate('Y-m-d H:i:s');
$hash = hash_hmac(
'md5',
strlen($vendorCode) . $vendorCode . strlen($date) . $date,
$apiKey
);
try {
$client = new SoapClient(
'https://api.2checkout.com/soap/6.0?wsdl',
['cache_wsdl' => WSDL_CACHE_NONE]
);
$sessionID = $client->login($vendorCode, $date, $hash);
$result = $client->dissociateAddon(
$sessionID,
'MAIN_PRODUCT_CODE', // ProductCode: the regular product
'ADDON_PRODUCT_CODE' // AddonCode: the addon product to dissociate
);
var_dump($result); // bool(true) on success
} catch (SoapFault $e) {
echo 'SoapFault: ' . $e->getMessage() . PHP_EOL;
}Response
Error codes
ADDON_SUBSCRIPTIONS_NOT_ENABLED
Add-ons are not enabled for your 2Checkout account.
PRODUCT_NOT_FOUND
The regular product cannot be found.
ADDON_NOT_ASSOCIATED
The addon is not associated with the regular product.
Last updated
Was this helpful?