Currency code error while using chargebee.UnbilledCharge.create API call

Modified on: Mon, 23 May, 2022 at 4:16 PM

Scope

chargebee.api_error.InvalidRequestError: currency_code : Not applicable when subscription_id is specified.


Summary


This error normally occurs when you pass the currency_code for Charges in PC 2.0Currency_code is applicable only when we raise unbilled charges for Quick Charges and it has to be the same as Subscription currency.


Solution


Referring to the API documentation for ‘Create unbilled charges for item subscription the ‘currency_code’ under Input parameters is ‘Required’ and not Optional.


Charges:

If you would like to add Charges, you need to pass on ‘item_prices[item_price_id][0..n]’ and while doing so, you don’t have to add ‘currency_code’ though you have multi-currency enabled. Chargebee will automatically consider the Subscription’s currency.



Quick Charges:

Quick charges require currency codes as they are charges that aren’t pre-defined and created manually. You will also see this parameter on the Chargebee UI.



Sample Screenshot of Quick Charges in Chargebee UI:



Hence, in the case of Quick Charges (or) one-time charges, it is required to pass the ‘currency_code’ parameter also the currency code must be the same as the subscription’s currency.



To know more about API docs


Related Links:


What is the difference between Charges and Quick Charges in PC 2.0?

How to view the details of changes to the unbilled charges via the API?

Error: "This API operation is not enabled for this site. Please contact support@chargebee.com to get this enabled"

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.
×