可从 Facebook 获取格式余额 api

Format balance availablefrom facebook api

我正在尝试获取 facebook 广告帐户的正负余额,但是,我正在关注 facebook 文档,同样说该字段是“余额”,下面我将打印自Facebook 文档。

我根据文档得到了这个值,问题是我不知道如何正确设置值的格式,这个值没有小数点分隔符,有人去过吗? 我怎么知道何时用小数格式化值?

下面是我从 API 获得的 return 的打印输出。

您应该将 AdAccounts 货币抵消视为 described here,作为静态 table:

Offset

Each currency has an offset which specifies how Facebook should handle its sub-divisions. This is to ensure that the minimum bid, such as "1", is a usable value for the currency.

Example offset 100

If a currency has an offset of 100 then the minimum allowed bid is assumed to be 1/100 of the currency base unit. For example, if you place a bid of "1" on an ad account based on USD the bid will be 0.01 USD.

Example offset 1

If a currency has an offset of 1 then the minimum allowed bid is assumed to be in the currency base unit. For example, if you place a bid of "1" on a ad account based on JPY the bid will be 1 JPY.

table的示例:

Name Code Offset
Algerian Dinar DZD 100
Argentine Peso ARS 100
.. .. ..
Brazilian Real BRL 100
.. .. ..
Chilean Peso CLP 1
.. .. ..

因此对于您的货币,您应该考虑 100 的偏移量。