function _uc_stripe_load_api in Ubercart Stripe 6
Same name and namespace in other branches
- 6.2 uc_stripe.install \_uc_stripe_load_api()
- 7 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 in ./
uc_stripe.module - Process the recurring fee transaction.
- uc_stripe_product_feature_validate in ./
uc_stripe.module - Validate the product feature save. Basically, ensure everything is Stripe compatible. Some options are not Stripe compatible and we have stripped out the UI but we double check to ensure the user has not attempted to circumvent those measures.
File
- ./
uc_stripe.module, line 685 - A module used for Stripe. Developed by Victor Quinn for Health for Hackers (http://www.healthforhackers.com)
Code
function _uc_stripe_load_api() {
if ($path = libraries_get_path('stripe')) {
// Load Stripe Library.
include_once $path . '/lib/Stripe.php';
}
else {
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;
}