Introducing the Chargebee CLI

Does Chargebee provide APIs to automatically convert the price into selected currency_code?

This article covers

  • Do I need to write custom code to convert cents into USD and GBP?
  • Does Chargebee provide a built-in function or setting that converts a plan price automatically?
  • Plan price conversion uses the smaller currency unit.

Summary

To pass a price in an API call, enter the amount in the smaller currency unit. For dollars, pass cents.

To set a plan price of 560 USD, pass 56000 (cents). If you pass 560, Chargebee displays 5.60 on the frontend.

Example:

curl https://xyz-test.chargebee.com/api/v2/plans \

-u {site_api_key}\

-d id="USDfinal" \

-d name="USDfinal" \

-d price=56000\

-d currency_code="USD"\

-d pricing_model="flat_fee"\

-d period_unit="month"\

-d period="1"