Docs
How do I pass the tiered plan when generating checkout using the Hosted Pages API?
When you pass quantity and tier prices to the Hosted Pages checkout API, you may see the error: "Subscription Item Tiers does not match with the original item price".
This occurs when you pass only one tier in the parameters. The API expects all tiers defined for the plan. If you pass a single tier, the tiers do not match the item price configuration.
Incorrect example (single tier – causes error):
curl --location --request POST 'https://{site_name}.chargebee.com/api/v2/hosted_pages/checkout_new_for_items'
--header 'Authorization: Basic site_key='
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'subscription_items[item_price_id][0]=test-INR-Every-6-months'
--data-urlencode 'item_tiers[item_price_id][0]=test-INR-Every-6-months'
--data-urlencode 'subscription_items[quantity][0]=25'
--data-urlencode 'item_tiers[starting_unit][0]=1'
--data-urlencode 'item_tiers[ending_unit][0]=20'
--data-urlencode 'item_tiers[price][0]=20000'
Correct example (all tiers):
curl --location --request POST 'https://{site_name}.chargebee.com/api/v2/hosted_pages/checkout_new_for_items'
--header 'Authorization: Basic site_key='
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'subscription_items[item_price_id][0]=test-INR-Every-6-months'
--data-urlencode 'subscription_items[quantity][0]=25'
--data-urlencode 'item_tiers[starting_unit][0]=1'
--data-urlencode 'item_tiers[ending_unit][0]=20'
--data-urlencode 'item_tiers[price][0]=20000'
--data-urlencode 'item_tiers[starting_unit][1]=21'
--data-urlencode 'item_tiers[ending_unit][1]=50'
--data-urlencode 'item_tiers[price][1]=50000'
--data-urlencode 'item_tiers[starting_unit][2]=51'
--data-urlencode 'item_tiers[price][2]=70000'
--data-urlencode 'item_tiers[item_price_id][0]=test-INR-Every-6-months'
--data-urlencode 'item_tiers[item_price_id][1]=test-INR-Every-6-months'
--data-urlencode 'item_tiers[item_price_id][2]=test-INR-Every-6-months'
Was this article helpful?