You are here

function _stripe_customer_retrieve in Stripe 7

Retrieve customer object from Stripe's servers.

Parameters

string $customer_id: The known Stripe Customer ID value.

Return value

\Stripe\Customer Customer object

3 calls to _stripe_customer_retrieve()
stripe_create_customer in stripe_customer/stripe_customer.module
Create a new Stripe customer for a user, or return one if it already exists.
stripe_get_customer in stripe_customer/stripe_customer.module
Get a Customer object from Stripe based on a customer_id.
_stripe_customer_delete in stripe_customer/stripe_customer.module
Delete a Stripe customer and update its status in the database.

File

stripe_customer/stripe_customer.module, line 189
Provides integration with Stripe and Drupal Users as Customers.

Code

function _stripe_customer_retrieve($customer_id) {
  stripe_load_library();
  try {

    // Create the Customer in Stripe.
    $customer = \Stripe\Customer::retrieve($customer_id);
    if ($customer) {
      return $customer;
    }
  } catch (Exception $e) {
    drupal_set_message(t('Could not retrieve Customer. Reason: @error', array(
      '@error' => $e
        ->getMessage(),
    )), 'error');
  }
}