Menu
Create An Attached Item
Create an attached item
/items/{item-id}/attached_itemsUse it in a workflow
- Add a step and choose the Chargebee connector.
- Pick the Create An Attached Item action (under Chargebee API).
- Fill in the fields below, then reference the result from later steps as
{{createAnAttachedItem.response.data}}.
Request
Path parameters
item-idstringrequiredHeaders
chargebee-request-origin-devicestringThe device from which the customer has made the request
chargebee-request-origin-userstring (email)The email address of your customer/user. Use this when the email address has only ASCII characters.
chargebee-request-origin-user-encodedstring (email)The Base64-encoded email address of your customer/user. Use this if the email address has UTF-8 characters. When this header is provided, the header chargebee-request-origin-user is ignored.
chargebee-request-origin-ipstringThe IP address of the customer where the request originated
chargebee-event-actionsstringskip all actions to be done on the events
One ofall-disabled
chargebee-event-emailstringskip only emails
One ofall-disabled
chargebee-event-webhookstringskip only webhooks
One ofall-disabled
chargebee-business-entity-idstringIf the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation.
Request body
Enter the body as JSON in the step's Body field.
item_idstringrequiredThe id of the addon or charge that is being attached to the plan-item.
typestring<p class="mb-2">The type of attachment for the addon. Only applicable for addon-items and is a required parameter as well for addon-items.</p> * recommended - <p class="mb-2">The addon is recommended to go with the plan-item when using <a href="https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout" target="_blank">Checkout</a> or <a href="https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription" target="_blank">Portal</a> .</p> * optional - <p class="mb-2">The addon is neither mandatory, nor recommended. This allows you to attach an addon so you can specify a <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">quantity</code> and <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">billing_cycles</code> for the addon, for when it is applied to subscriptions with the plan.</p> * mandatory - <p class="mb-2">The addon is attached automatically to the subscription for the plan-item unless <a href="/docs/api/subscriptions">explicitly removed</a> via API.</p>
One ofrecommendedmandatoryoptional
billing_cyclesinteger (int32)<p class="mb-2">The number of subscription billing cycles for which this item is attached when applied to a subscription. Applicable only for items of type addon. Requires <a href="https://www.chargebee.com/docs/2.0/addons-billingcycle.html" target="_blank">addon billing cycles</a> to be enabled for the site.</p> <p class="mb-2">The value set explicitly for <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">billing_cycles</code> while <a href="/docs/api/subscriptions/subscription-object#subscription_items">applying the addon to a subscription</a> takes precedence over this parameter. This parameter, in turn, has a higher precedence than <a href="/docs/api/item_prices">the value set for the addon-item price</a> .</p>
quantityinteger (int32)The default quantity of the addon to be attached when the quantity is not specified while [creating](/docs/api/subscriptions/create-subscription-for-items) /[updating](/docs/api/subscriptions/update-subscription-for-items) the subscription.
quantity_in_decimalstringThe decimal representation of the quantity of the addon. Returned for quantity-based addons when [multi-decimal pricing](/docs/api/getting-started) is enabled.
charge_on_eventstring<p class="mb-2">Indicates when the item is charged. This parameter only applies to charge-items.</p> * contract_termination - <p class="mb-2">when a contract term is <a href="/docs/api/subscriptions/cancel-subscription-for-items#contract_term_cancel_option">terminated</a> .</p> * subscription_creation - <p class="mb-2">the time of creation of the subscription.</p> * subscription_trial_start - <p class="mb-2">the time when the trial period of the subscription begins.</p> * on_demand - <p class="mb-2">Item can be charged on demand</p> * plan_activation - <p class="mb-2">same as subscription activation, but also includes the case when the plan-item of the subscription is changed.</p> * subscription_activation - <p class="mb-2">the moment a subscription enters an <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">active</code> or <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">non-renewing</code> state. Also includes reactivations of canceled subscriptions.</p>
One ofsubscription_creationsubscription_trial_startplan_activationsubscription_activationcontract_terminationon_demand
charge_onceboolean<p class="mb-2">Indicates if the charge-item is to be charged only once or each time the <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">charge_on_event</code> occurs. This parameter only applies to charge-items.</p>
business_entity_idstring<p class="mb-2">The unique ID of the <a href="/docs/api/business_entities">business entity</a> for this <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">attached_item</code>. This is applicable only when multiple business entities have been created for the site. When provided, the operation will read or write data associated with the specified business entity. If not provided, the resource will be created at the site level, and the <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">business_entity_id</code> will not be included in the API response.</p> <p class="mb-2"><strong class="font-semibold">Note</strong>: An alternative way of passing this parameter is by using a <a href="/docs/api/advanced-features">custom HTTP header</a> or <a href="/docs/api/advanced-features#mbe-alternative">query string parameter</a>.</p> <span featureId="cb-mbe" isMicro="true"></span>
{
"item_id": null,
"type": null,
"billing_cycles": null,
"quantity": null,
"quantity_in_decimal": null,
"charge_on_event": null,
"charge_once": null,
"business_entity_id": null
}
Response
Returns 200 with an object. Read it in later steps with {{createAnAttachedItem.response.data.<field>}}.
attached_itemobject<div class="api-description"><p class="mb-2">Addon-item and charge-item prices are purchased with plan-item prices in subscriptions. You can automate this process by configuring certain addons and charges as "attached" to certain plans. This is done at the "item" level. In other words, addon- and charge-items can be attached to plan-items.</p><p class="mb-2">Once the attachment is defined, while creating or updating a subscription, the addon- or charge-item prices are selected automatically based on the plan-item price selected . Let's look at the details:</p><h3>Addons</h3><p class="mb-2">Addons can be attached to plans as <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">recommended</code>, <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">mandatory</code> or <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">optional</code>.</p><ul class="list-disc list-outside ml-6 my-4 space-y-2"> <li class="text-base leading-relaxed">When an addon is attached as <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">recommended</code> for a plan, the addon is suggested to be applied to subscriptions for the plan in <a href="https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout" target="_blank">Checkout</a> and <a href="https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription" target="_blank">Self-Serve Portal</a>. Alternatively, if you build your own payment pages or have a sales team, you can suggest recommended addons to your customers or salespeople on your website or CRM respectively</li> <li class="text-base leading-relaxed">When an addon is attached as <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">mandatory</code> for a plan, the addon gets applied to subscriptions for the plan compulsorily, unless <a href="/docs/api/subscriptions">removed explicitly</a>. If you do not pass an item price for a mandatory addon when including the plan in a subscription, an addon-item price is automatically applied as explained below.</li> <li class="text-base leading-relaxed">Attaching an addon as <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">optional</code> neither marks it as recommended or mandatory but allows you a way to set a <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">quantity</code> and <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">billing_cycles</code> for the addon, for when it is applied to subscriptions with the plan.</li> </ul><h2>How auto-selection of the addon-item price works</h2><p class="mb-2">Once an addon has been attached as mandatory, the addon-item price to be applied to the plan-item price is selected based on the following rule: The addon-item price with the same currency as that of the plan-item price and the longest compatible period is selected.</p><p class="mb-2">Here's an example:</p><p class="mb-2">Consider a plan <strong class="font-semibold">Standard Cloud Storage</strong> has an addon <strong class="font-semibold">Extra Storage</strong> attached to it. Note that each of the two are items. Now consider that they have item prices with the following periods and currencies:</p><p class="mb-2"><strong class="font-semibold">Item price for "Standard Cloud Storage" plan-item:</strong></p><ul class="list-disc list-outside ml-6 my-4 space-y-2"> <li class="text-base leading-relaxed">Standard Cloud Storage, 3 years, AUD.</li> </ul><p class="mb-2"><strong class="font-semibold">Item prices for "Extra Storage" addon-item:</strong></p><ul class="list-disc list-outside ml-6 my-4 space-y-2"> <li class="text-base leading-relaxed">Extra Storage, 1 year, EUR.</li> <li class="text-base leading-relaxed">Extra Storage, 1 year, USD.</li> <li class="text-base leading-relaxed">Extra Storage, 1 year, AUD.</li> <li class="text-base leading-relaxed">Extra Storage, 18 months, AUD.</li> <li class="text-base leading-relaxed">Extra Storage, 2 years, AUD.</li> <li class="text-base leading-relaxed">Extra Storage, 30 months, AUD.</li> </ul><p class="mb-2">For the plan-item price (Standard Cloud Storage, 3 years, AUD), the addon-item prices with matching currencies are the last 4 from the above list:</p><ul class="list-disc list-outside ml-6 my-4 space-y-2"> <li class="text-base leading-relaxed">Extra Storage, 1 year, AUD.</li> <li class="text-base leading-relaxed">Extra Storage, 18 months, AUD.</li> <li class="text-base leading-relaxed">Extra Storage, 2 years, AUD.</li> <li class="text-base leading-relaxed">Extra Storage, 30 months, AUD.</li> </ul><p class="mb-2">From among them, the last two have periods that are incompatible with the plan-item price period of 3 years. From the remaining 2 addon-item prices, the one with the longest period is of 18 months. So, "Extra Storage, 18 months, AUD" is selected for mandatory application to the plan item price.</p><h3>Charges</h3><p class="mb-2">Charges can also be attached to plans. When doing so, you specify <a href="/docs/api/attached_items/attached_item-object#charge_on_event">the event</a> at which the charge is to be applied to the subscription. For some events that can occur multiple times in a subscription lifetime, you can also set whether to apply the charge each time the event occurs or just once.</p><p class="mb-2">There may be multiple item prices for a given attached charge. The item price that matches the currency of the plan-item price is automatically selected for application.</p><p class="mb-2">Here's an example:</p><p class="mb-2">Consider a plan <strong class="font-semibold">Standard Cloud Storage</strong> has a charge named <strong class="font-semibold">Implementation Fee</strong> attached to it. Now consider their item prices below, with the following periods and currencies:</p><p class="mb-2"><strong class="font-semibold">Item price for "Standard Cloud Storage" plan-item:</strong></p><ul class="list-disc list-outside ml-6 my-4 space-y-2"> <li class="text-base leading-relaxed">Standard Cloud Storage, 3 years, AUD.</li> </ul><p class="mb-2"><strong class="font-semibold">Item prices for "Implementation Fee" charge-item:</strong></p><ul class="list-disc list-outside ml-6 my-4 space-y-2"> <li class="text-base leading-relaxed">Implementation Fee, USD.</li> <li class="text-base leading-relaxed">Implementation Fee, AUD.</li> <li class="text-base leading-relaxed">Implementation Fee, EUR.</li> </ul><p class="mb-2">From among the charge-item prices above, the one compatible with the plan-item price is "Implementation Fee, AUD" since it has the same currency as the plan-item price.</p></div>
idstringrequiredThe unique id for the attached item. Set to a random, immutable value automatically when the attached item is created.
parent_item_idstringrequired<p class="mb-2">The <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">id</code> of the plan-item to which the item is attached.</p>
item_idstringrequiredThe id of the item being attached.
typestringrequired<p class="mb-2">The type of attachment for the addon. Only applicable for addon-items.</p> * recommended - <p class="mb-2">The addon is recommended to go with the plan-item when using <a href="https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout" target="_blank">Checkout</a> or <a href="https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription" target="_blank">Portal</a> .</p> * optional - <p class="mb-2">The addon is neither mandatory, nor recommended. This allows you to attach an addon so you can specify a <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">quantity</code> and <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">billing_cycles</code> for the addon, for when it is applied to subscriptions with the plan.</p> * mandatory - <p class="mb-2">The addon is attached automatically to the subscription for the plan-item unless <a href="/docs/api/subscriptions">explicitly removed</a> via API.</p>
One ofrecommendedmandatoryoptional
statusstringThe item state. \* active - New subscriptions can be created with the item. \* deleted - No subscriptions allowed for the item. \* archived - No new subscriptions allowed for the item.
One ofactivearchiveddeleted
quantityinteger (int32)The default quantity of the addon to be attached when the quantity is not specified while [creating](/docs/api/subscriptions/create-subscription-for-items) /[updating](/docs/api/subscriptions/update-subscription-for-items) the subscription.
quantity_in_decimalstringThe decimal representation of the quantity of the addon. Returned for quantity-based addons when [multi-decimal pricing](/docs/api/getting-started) is enabled.
billing_cyclesinteger (int32)<p class="mb-2">The number of subscription billing cycles for which this item is attached when applied to a subscription. Applicable only for items of type addon. Requires <a href="https://www.chargebee.com/docs/2.0/addons-billingcycle.html" target="_blank">addon billing cycles</a> to be enabled for the site.</p> <p class="mb-2">The value set explicitly for <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">billing_cycles</code> while <a href="/docs/api/subscriptions/subscription-object#subscription_items">applying the addon to a subscription</a> takes precedence over this attribute. This attribute, in turn, has a higher precedence than <a href="/docs/api/item_prices">the value set for the addon-item price</a> .</p>
charge_on_eventstringrequired<p class="mb-2">Indicates when the item is charged. This attribute only applies to charge-items.</p> * contract_termination - <p class="mb-2">when a contract term is <a href="/docs/api/subscriptions/cancel-subscription-for-items#contract_term_cancel_option">terminated</a> .</p> * subscription_creation - <p class="mb-2">the time of creation of the subscription.</p> * subscription_trial_start - <p class="mb-2">the time when the trial period of the subscription begins.</p> * on_demand - <p class="mb-2">Item can be charged on demand</p> * plan_activation - <p class="mb-2">same as subscription activation, but also includes the case when the plan-item of the subscription is changed.</p> * subscription_activation - <p class="mb-2">the moment a subscription enters an <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">active</code> or <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">non-renewing</code> state. Also includes reactivations of canceled subscriptions.</p>
One ofsubscription_creationsubscription_trial_startplan_activationsubscription_activationcontract_terminationon_demand
charge_oncebooleanrequired<p class="mb-2">Indicates if the charge-item is to be charged only once or each time the <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">charge_on_event</code> occurs. This attribute only applies to charge-items.</p>
created_atinteger (unix-time)requiredThe time at which this attached item was created.
resource_versioninteger (int64)<p class="mb-2">Version number of this resource. The <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">resource_version</code> is updated with a new timestamp in milliseconds for every change made to the resource. This attribute will be present only if the resource has been updated after 2016-09-28.</p>
updated_atinteger (unix-time)The time at which this attached item was last updated.
channelstringThe subscription channel this object originated from and is maintained in. \* web - The object was created (and is maintained) for the web channel directly in Chargebee via API or UI. \* app_store - The object data is synchronized with data from [in-app subscription(s)](/docs/api/in_app_subscriptions) created in Apple App Store. Direct manipulation of this object via UI or API is disallowed. \* play_store - The object data is synchronized with data from [in-app subscription(s)](/docs/api/in_app_subscriptions) created in Google Play Store. Direct manipulation of this object via UI or API is disallowed.
One ofwebapp_storeplay_store
business_entity_idstringThe unique ID of the [business entity](/docs/api/getting-started) of this subscription. This is applicable only when multiple business entities have been created for the site. The value of this attribute indicates that the resource is specific to the given business entity.
deletedbooleanrequiredIndicates whether the attached item has been deleted or not.
{
"attached_item": null
}
Need more? See the Chargebee guide for connection setup and behaviour shared by every action.