/** * 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->user->stripeId) { $customer = $this->user->createAsStripeCustomer($token, array_merge($options, array_filter(['coupon' => $this->coupon]))); } else { $customer = $this->user->asStripeCustomer(); if ($token) { $this->user->updateCard($token); } } return $customer; }
/** * Get the Braintree customer instance for the current user and token. * * @param string|null $token * @param array $options * * @return \Braintree\Customer */ protected function getBraintreeCustomer($token = null, array $options = []) { if (!$this->user->braintreeId) { $customer = $this->user->createAsBraintreeCustomer($token, $options); } else { $customer = $this->user->asBraintreeCustomer(); if ($token) { $this->user->updateCard($token); } } return $customer; }