public function create($authorized, array $options)
    {

        if($authorized instanceof Shopify)
        {
            if(!$authorized->getUser())
                throw new Exception('Cannot charge user without getting their installation permissions!');

            $this->setRequestPath( $authorized );
            $token = $authorized->getUser()->token;
        }
        elseif($authorized instanceof User)
        {
            $this->setRequestPath($authorized->name);
            $token = $authorized->token;
        }
        else throw new \InvalidArgumentException('Argumant must be an instance of Shopify or Laravel\Socialite\Two\User');

        $this->options = $options;


        $createURL = $this->getChargeEndpoint() . '.json';


        $this->charge = $this->getCreateChargeResponse($createURL, $token);

        return $this;
    }
public function create($authorized, array $options)
    {

        if($authorized instanceof Shopify)
        {
            if(!$authorized->getUser())
                throw new Exception('Cannot charge user without getting their installation permissions!');

            $this->setRequestPath( $authorized );
            $token = $authorized->getUser()->token;
        }
        elseif($authorized instanceof User)
        {
            $this->setRequestPath($authorized->name);
            $token = $authorized->token;
        }
        else throw new \InvalidArgumentException('Argumant must be an instance of Shopify or Laravel\Socialite\Two\User');

        $this->options = $options;


        $createURL = $this->getChargeEndpoint() . '.json';


        $this->charge = $this->getCreateChargeResponse($createURL, $token);

        return $this;
    }
public function create ( $ authorized , array $ options ) { if ( $ authorized instanceof Shopify ) { if ( ! $ authorized -> getUser ( ) ) throw new Exception ( 'Cannot charge user without getting their installation permissions!' ) ; $ this -> setRequestPath ( $ authorized ) ; $ token = $ authorized -> getUser ( ) -> token ; } elseif ( $ authorized instanceof User ) { $ this -> setRequestPath ( $ authorized -> name ) ; $ token = $ authorized -> token ; } else throw new \ InvalidArgumentException ( 'Argumant must be an instance of Shopify or Laravel\Socialite\Two\User' ) ; $ this -> options = $ options ; $ createURL = $ this -> getChargeEndpoint ( ) . '.json' ; $ this -> charge = $ this -> getCreateChargeResponse ( $ createURL , $ token ) ; return $ this ; }
Create a Charge

@param Object $authorized instanceof Shopify || User
@param array $options
@return $this
@throws Exception
Create a Charge