diff --git a/commerce_stripe.module b/commerce_stripe.module index c1fae62..377eeb5 100755 --- a/commerce_stripe.module +++ b/commerce_stripe.module @@ -1521,11 +1521,15 @@ function _commerce_stripe_set_api_key($payment_method) { */ function commerce_stripe_payment_currencies() { commerce_stripe_load_library(); + $supported_currencies = array(); $payment_method = commerce_payment_method_instance_load('commerce_stripe|commerce_payment_commerce_stripe'); - _commerce_stripe_set_api_key($payment_method); - $info = \Stripe\Account::retrieve(); - $country_spec = \Stripe\CountrySpec::retrieve($info->country); - $supported_currencies = $country_spec->supported_payment_currencies; + + if (!empty($payment_method['settings']['secret_key'])) { + _commerce_stripe_set_api_key($payment_method); + $info = \Stripe\Account::retrieve(); + $country_spec = \Stripe\CountrySpec::retrieve($info->country); + $supported_currencies = $country_spec->supported_payment_currencies; + } return $supported_currencies; }