You are here

function stripe_create_customer in Stripe 7

Create a new Stripe customer for a user, or return one if it already exists.

File

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

Code

function stripe_create_customer($user, $params = array()) {

  // Ensure we have a fully-loaded user.
  if (is_int($user)) {
    $user = user_load($user);
  }
  else {
    $user = user_load($user->uid);
  }
  if (isset($user->stripe_customer_id)) {
    return _stripe_customer_retrieve($user->stripe_customer_id);
  }
  else {
    return _stripe_customer_create($user, $params);
  }
}