Example #1
0
 /**
  * Get the Stripe customer instance for the current user and token.
  *
  * @param  string|null  $token
  * @param  array  $options
  * @return \Stripe\Customer
  */
 protected function getStripeCustomer($token = null, array $options = [])
 {
     if (!$this->owner->stripe_id) {
         $customer = $this->owner->createAsStripeCustomer($token, array_merge($options, array_filter(['coupon' => $this->coupon])));
     } else {
         $customer = $this->owner->asStripeCustomer();
         if ($token) {
             $this->owner->updateCard($token);
         }
     }
     return $customer;
 }