Associate an addon to a product
Use the associateAddon method to associate an addon product with a regular product. Once associated, the addon can be purchased together with the regular product or added to an active subscription generated by it. Addons cannot be sold on their own.
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
Before the association is created, 2Checkout checks that:
• both products exist;
• ProductCode is a regular product and AddonCode is an addon product;
• both products have the same billing cycle;
• the association does not already exist.
An addon can be associated with several regular products, and a regular product can have several addons. Associations are created one pair of products at a time.
Request sample
<?php
require ('PATH_TO_AUTH');
$jsonRpcRequest = array (
'method' => 'associateAddon',
'params' => array($sessionID, 'MAIN_PRODUCT_CODE', 'ADDON_PRODUCT_CODE'),
'id' => $i++,
'jsonrpc' => '2.0'
);
var_dump (callRPC((Object)$jsonRpcRequest, $host, true));
Response
Error codes
ADDON_SUBSCRIPTIONS_NOT_ENABLED
Add-ons are not enabled for your 2Checkout account.
PRODUCT_NOT_FOUND
The regular product or the addon product cannot be found.
INVALID_PRODUCT
ProductCode is not a regular product, or AddonCode is not an addon product.
BILLING_CYCLE_MISMATCH
The billing cycle of the addon differs from the billing cycle of the regular product.
ADDON_ALREADY_ASSOCIATED
The addon is already associated with the regular product.
Last updated
Was this helpful?