bitpay / php-bitpay-client

PHP implementation for the BitPay cryptographically secure RESTful API
MIT License
165 stars 149 forks source link

Incorrect maximum BTC precision? #227

Closed ar-turek closed 6 years ago

ar-turek commented 7 years ago

According to this (and BTC specification in general): https://en.bitcoin.it/wiki/Help:FAQ#How_divisible_are_bitcoins.3F the smallest BTC unit is 10^(-8), which means the biggest acceptable decimal precision should be 8 decimal places.

Here: https://github.com/bitpay/php-bitpay-client/blob/master/src/Bitpay/Client/Client.php#L698 a value with 8 decimal places does not pass this check unless it's rounded up to 6 decimal places, even though in theory it should be possible to pay 0.00000001BTC.

tomaszkane commented 7 years ago

BTW, IPN from BitPay also sends btcPrice with 6 decimal places.

pieterpoorthuis commented 6 years ago

Currently BitPay accepts 6 decimals. The BitPay lib follows this specification.