Drupal Commerce: How to get payment module settings?
I'm using this:

$payment = commerce_payment_method_instance_load('foo|commerce_payment_foo');


where foo is the payment method string identifier.

The resulting array contains the 'settings' index, with the data saved in the settings form.



In other words foo|commerce_payment_foo is instance id which consist method_id|rule_name.

The method_id can be found by executing commerce_payment_methods() and rule_name can be found in URL when editing Payment action (at /admin/commerce/config/payment-methods).