Today we're going to see how we can retrieve the payment method settings when ever we required. The payment methods are used to accept the payments from user during Checkout process. More details on payment in Drupal Commerce can be found here. To get the payment method settings we will need the payment method enabled in our Drupal Commerce site. By default when we install payment module we also get an example payment method which we can use. In this example I'm using the Commerce Authorize.net payment gateway integration module, which provides the payment method named as "authnet_aim". Here's how we can get the specified payment method settings in just one line:
<?php
  $payment = commerce_payment_method_instance_load('authnet_aim|commerce_payment_authnet_aim');
?>
The commerce_payment_method_instance_load() function, Returns a payment method instance array which includes the settings specific to the context of the instance.

Reference:

Submitted by ychaugule on