function _uc_stripe_load_api in Ubercart Stripe 7
Same name and namespace in other branches
- 6.2 uc_stripe.install \_uc_stripe_load_api()
- 6 uc_stripe.module \_uc_stripe_load_api()
Load the Stripe API, assign the key
4 calls to _uc_stripe_load_api()
- uc_stripe_cancel in ./
uc_stripe.module - Cancel the recurring fee using the Stripe API.
- uc_stripe_charge in ./
uc_stripe.module - uc_credit callback for creating an actual credit card charge
- uc_stripe_process_payment in ./
uc_stripe.module - Process the recurring fee transaction.
- uc_stripe_product_feature_validate in ./
uc_stripe.module - Validate the product feature save.
File
- ./
uc_stripe.module, line 695 - A module used for processing payments with Stripe.
Code
function _uc_stripe_load_api() {
$library = libraries_load('stripe-php');
if (!$library['installed'] && !$library['loaded']) {
watchdog('uc_stripe', 'Stripe Library not found. Please download into sites/all/libraries/stripe', array(), WATCHDOG_WARNING);
return FALSE;
}
$apikey = variable_get('uc_stripe_testmode', TRUE) ? variable_get('uc_stripe_api_key_dev', '') : variable_get('uc_stripe_api_key_prod', '');
if ($apikey == '') {
watchdog('uc_stripe', 'No Stripe API key is set. Payment cannot go through until set.', array(), WATCHDOG_WARNING);
return FALSE;
}
try {
Stripe::setApiKey($apikey);
} catch (Exception $e) {
watchdog('uc_stripe', 'Error setting the Stripe API Key. Payments will not be processed: %error', array(
'%error' => $e
->getMessage(),
));
}
return TRUE;
}