You are here

function _commerce_stripe_set_api_key in Commerce Stripe 7.3

1 call to _commerce_stripe_set_api_key()
commerce_stripe_payment_currencies in ./commerce_stripe.module
Supported payment currencies will vary by location of the Stripe account.

File

./commerce_stripe.module, line 1689
This module provides Stripe (http://stripe.com/) payment gateway integration to Commerce. Commerce Stripe offers a PCI-compliant way to process payments straight from you Commerce shop.

Code

function _commerce_stripe_set_api_key($payment_method) {
  if (!empty($payment_method['settings']['secret_key'])) {
    Stripe\Stripe::setApiKey(trim($payment_method['settings']['secret_key']));
  }
  elseif (!empty($payment_method['settings']['use_connected_account']) && $payment_method['settings']['use_connected_account'] == 'site account') {
    if (module_exists('commerce_stripe_connect')) {
      $connect_settings = commerce_stripe_connect_get_settings();
      Stripe\Stripe::setApiKey(trim($connect_settings['connected_secret_key']));
    }
  }
}