btcpayserver / woocommerce-plugin

Plugin for connecting Woocommerce with BTCPayServer
https://btcpayserver.org/
Other
51 stars 41 forks source link

The currency code "XLM" is not supported #68

Closed MatapaCoin closed 2 years ago

MatapaCoin commented 2 years ago

hi, i've got a store on woocommerce that sells tokens but i would like to do it using Stellar XLM. For this, I have added the following code in the functions.php file of the main theme: ( I have also tried it with the plugin All Currencies for WooCommerce and the same thing happens )

add_filter( 'woocommerce_currencies', 'add_custom_currency' ); function add_custom_currency( $wc_currency ) { $wc_currency['XLM'] = __( 'XLM Stellar', 'woocommerce' ); return $wc_currency; } add_filter('woocommerce_currency_symbol', 'add_custom_currency_symbol', 10, 2); function add_custom_currency_symbol( $custom_currency_symbol, $custom_currency ) { switch( $custom_currency ) { case 'XLM': $custom_currency_symbol = 'XLM'; break; } return $custom_currency_symbol;

}

image

I update the woocomerce settings page and I can see the new currency, but in the payment settings, the plugin is automatically disabled

image

Logs

11-05-2021 @ 12:41:28 - [Error] In is_valid_for_use: The currency code "XLM" is not supported. 11-05-2021 @ 12:41:28 - [Info] The plugin is NOT valid for use!

Additional context

It works fine with the "pay button", but I require it to work with the woocomerce store.

Thanks! Ruddy

Kukks commented 2 years ago

Xlm is not supported by btcpay officially or unofficially so this is impossible.

pavlenex commented 2 years ago

@Kukks It seems they're using a different plugin than ours?

MatapaCoin commented 2 years ago

Xlm is not supported by btcpay officially or unofficially so this is impossible.

and yet using the payment button it works image

pavlenex commented 2 years ago

@MatapaCoin No, this is btc just priced in XML, which is weird, but I guess XML is supported currency list

NicolasDorier commented 2 years ago

but I guess XML is supported currency list

@MatapaCoin @pavlenex we do not have such a list. We support in the invoice whichever currency is supported by the rating source. If he selected say Kraken and Kraken have a BTC/XML pair, then this will be used.

I think the currency field should be left free in the plugin.

NicolasDorier commented 2 years ago

I actually close this issue because we don't have a currency field in our plugin.

NicolasDorier commented 2 years ago

Try to change this line https://github.com/btcpayserver/woocommerce-plugin/blob/master/src/class-wc-gateway-btcpay.php#L290 to

new \Bitpay\CurrencyUnrestricted(get_woocommerce_currency());

NicolasDorier commented 2 years ago

I just fixed this line with 3.0.15

NicolasDorier commented 2 years ago

@MatapaCoin it worked?

MatapaCoin commented 2 years ago

@MatapaCoin it worked?

Hi Nicolas, thanks for asking. yes it works, the plugin is not disabled when I set the XLM as currency, thanks for that, but i think the error may come now from woocommerce. (now, I will analyze in more detail the problem with woocommerce.)

Log:

11-08-2021 @ 11:34:10 - [Info] Leaving class level btcpay_decrypt... 11-08-2021 @ 11:34:10 - [Info] API Token decrypted successfully. 11-08-2021 @ 11:34:10 - [Info] Transaction speed is now set to: default 11-08-2021 @ 11:34:10 - [Info] Plugin is valid for use. 11-08-2021 @ 11:34:10 - [Info] The plugin is ok to use.

image

Thanks Ruddy