function stripe_get_key in Stripe 7
Get the stripe key(s).
Parameters
string $type: The type of the key to retrieve, either 'secret' or 'publishable' (optional).
string $set: The keys set to use, either 'test' or 'live'. Defaults to the value of the 'stripe_key_status' variable.
Return value
array|string If $type is NULL, an array containing both the secret and publishable keys. Otherwise, the request keys.
6 calls to stripe_get_key()
- StripePaymentMethodController::execute in stripe_payment/
includes/ StripePaymentMethodController.inc - Execute a payment.
- StripePaymentMethodController::payment_configuration_form_elements in stripe_payment/
includes/ StripePaymentMethodController.inc - Builder callback for the payment configuration form elements.
- StripePaymentMethodController::retrieveAccount in stripe_payment/
includes/ StripePaymentMethodController.inc - Retrieve the Stripe Account object for a given Payment Method.
- StripePaymentMethodController::retrieveCharge in stripe_payment/
includes/ StripePaymentMethodController.inc - Retrieve the Stripe Charge object for a given Payment.
- StripePaymentMethodController::retrieveToken in stripe_payment/
includes/ StripePaymentMethodController.inc - Retrieve the Stripe Token object for a given Payment.
File
- ./
stripe.module, line 471 - stripe.module Drupal hooks used for integrating the Stripe service.
Code
function stripe_get_key($type = NULL, $set = NULL) {
$keys = drupal_static(__FUNCTION__, array());
if ($set === NULL) {
$set = variable_get('stripe_key_status', 'test');
}
if (empty($keys[$set])) {
$keys[$set] = array(
'secret' => variable_get("stripe_{$set}_secret", ''),
'publishable' => variable_get("stripe_{$set}_publishable", ''),
);
}
return $type === NULL ? $keys[$set] : (isset($keys[$set][$type]) ? $keys[$set][$type] : NULL);
}