Payment Double
kosik opened this issue · comments
new LabeledPrice("5 EUR volume", 5)
LabeledPrice class accepts Integer into amount field. In the same time, money is a decimal, represented by Double in java.
If to pass into the field a small value, with only single position, the response returns error:
{"ok":false,"error_code":400,"description":"Bad Request: can't parse labeled price: Can't parse "5.00" as an integer"}
I attempted to apply a quick-fix in a local branch, changing the type to Double, but this did not helped. Could you please advise a possible solution of such cases
Класс LabeledPrice принимает целое число в поле amount. В то же время, деньги это дробное число, в Java представлено Double. Если передать в amount небольшое значение, имеющее только одну позицию, ответ вернет ошибку:
{"ok":false,"error_code":400,"description":"Bad Request: can't parse labeled price: Can't parse "5.00" as an integer"}
Я попытался применить быстрое исправление в локальной ветке, изменив тип на Double, но это не помогло.
Буду признателень за помощь
Aha, found the answer in official documentation:
https://core.telegram.org/bots/api#labeledprice
Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
thanks