src/gateways/Gateway.php
private function _getStripeCustomer(int $userId): Customer
    {
        try {
            $user = Craft::$app->getUsers()->getUserById($userId);
            $customers = StripePlugin::getInstance()->getCustomers();
            $customer = $customers->getCustomer($this->id, $user);
            return Customer::retrieve($customer->reference);
        } catch (\Exception $exception) {
            throw new CustomerException('Could not fetch Stripe customer: ' . $exception->getMessage());
        }
    }
private function _getStripeCustomer(int $userId): Customer
    {
        try {
            $user = Craft::$app->getUsers()->getUserById($userId);
            $customers = StripePlugin::getInstance()->getCustomers();
            $customer = $customers->getCustomer($this->id, $user);
            return Customer::retrieve($customer->reference);
        } catch (\Exception $exception) {
            throw new CustomerException('Could not fetch Stripe customer: ' . $exception->getMessage());
        }
    }
private function _getStripeCustomer ( int $ userId ) : Customer { try { $ user = Craft :: $ app -> getUsers ( ) -> getUserById ( $ userId ) ; $ customers = StripePlugin :: getInstance ( ) -> getCustomers ( ) ; $ customer = $ customers -> getCustomer ( $ this -> id , $ user ) ; return Customer :: retrieve ( $ customer -> reference ) ; } catch ( \ Exception $ exception ) { throw new CustomerException ( 'Could not fetch Stripe customer: ' . $ exception -> getMessage ( ) ) ; } }
Get the Stripe customer for a User.

@param int $userId

@return Customer
@throws CustomerException if wasn't able to create or retrieve Stripe Customer.
Get the Stripe customer for a User .