Idan-Neeman / Crypto-Payments-Woo

Accept Bitcoin/FairCoin payment from WooCommerce store without help of middle man! Receive payment instantly and directly to your own coin address (generate on-the-fly by Electrum) without rotating to 3rd party wallet.
GNU General Public License v2.0
2 stars 1 forks source link

SyntaxError: Unexpected token l in JSON at position 1 #3

Open stan-ivanov opened 2 years ago

stan-ivanov commented 2 years ago

Hey there,

I know you don't maintain the plugin but do you have an idea why after WP v.5.4 and Woo v.4+ when at checkout click button to finish the order got this error? More specific:

ERROR: cannot generate crypto address for the order: 'API failure.'

To add more: When I var_dump($ret_info_array);, the result is:

array(4) { ["result"]=> string(5) "error" ["message"]=> string(12) "API failure." ["host_reply_raw"]=> string(0) "" ["generated_bitcoin_address"]=> bool(false) }

There are addresses in DB table d0u_wcp_addresses_btc.

More info - Upon checkout the addresses are created in the database table but they are with the status Unknown if I manually change one address to unused everything starts working just fine.

Idan-Neeman commented 2 years ago

Hey, First, if the plugin produces addresses and you see them in DB it's great. A situation where an address is defined as unknown is a situation in which the selected provider does not provide a valid balance as the plugin expects to receive: https://github.com/Idan-Neeman/Crypto-Payments-Woo/blob/b48b102288ea2a865f0c54585b41a8bb189082f0/wcp-utils.php#L351

I suggest checking the data received from the providers, there may have been changes in their API. (Look at wcp-crypto-blockchain-apis.php)

Please update 👍