function _uc_stripe_prepare_api in Ubercart Stripe 6.2
Same name and namespace in other branches
- 7.3 uc_stripe.module \_uc_stripe_prepare_api()
- 7.2 uc_stripe.module \_uc_stripe_prepare_api()
Load stripe API
Return value
bool
3 calls to _uc_stripe_prepare_api()
- drush_uc_stripe_subscription_cancel in ./
uc_stripe.drush.inc - Command callback
- uc_stripe_charge in ./
uc_stripe.module - Generic "charge" callback that runs on checkout and via the order's "card" terminal
- uc_stripe_renew in ./
uc_stripe.module - Handle renewing a recurring fee, called by uc_recurring
File
- ./
uc_stripe.module, line 562 - A stripe.js PCI-compliant payment gateway Forked from Bitcookie's work (thanks!) which was posted at http://bitcookie.com/blog/pci-compliant-ubercart-and-stripe-js from discussion in the uc_stripe issue queue, https://www.drupal.org/node/1467886
Code
function _uc_stripe_prepare_api() {
module_load_include('install', 'uc_stripe');
if (!_uc_stripe_load_api()) {
return FALSE;
}
if (!_uc_stripe_check_api_keys()) {
watchdog('uc_stripe', 'Stripe API keys are not configured. Payments cannot be made without them.', array(), WATCHDOG_ERROR);
return FALSE;
}
$secret_key = variable_get('uc_stripe_testmode', TRUE) ? variable_get('uc_stripe_api_key_test_secret', '') : variable_get('uc_stripe_api_key_live_secret', '');
try {
Stripe::setApiKey($secret_key);
} catch (Exception $e) {
watchdog('uc_stripe', 'Error setting the Stripe API Key. Payments will not be processed: %error', array(
'%error' => $e
->getMessage(),
));
}
return TRUE;
}