public function activate()
    {
        // Check if we have a charge ID to use
        if (!$this->chargeId) {
            throw new Exception('Can not activate plan without a charge ID.');
        }

        // Activate and return the API response
        $this->response = $this->api->rest(
            'POST',
            "/admin/{$this->plan->typeAsString(true)}/{$this->chargeId}/activate.json"
        )->body->{$this->plan->typeAsString()};

        return $this->response;
    }
public function activate()
    {
        
        if (!$this->chargeId) {
            throw new Exception('Can not activate plan without a charge ID.');
        }

        
        $this->response = $this->api->rest(
            'POST',
            "/admin/{$this->plan->typeAsString(true)}/{$this->chargeId}/activate.json"
        )->body->{$this->plan->typeAsString()};

        return $this->response;
    }
public function activate ( ) { // Check if we have a charge ID to use if ( ! $ this -> chargeId ) { throw new Exception ( 'Can not activate plan without a charge ID.' ) ; } // Activate and return the API response $ this -> response = $ this -> api -> rest ( 'POST' , "/admin/{$this->plan->typeAsString(true)}/{$this->chargeId}/activate.json" ) -> body -> { $ this -> plan -> typeAsString ( ) } ; return $ this -> response ; }
Activates a plan to the shop.

Example usage:
(new BillingPlan([shop], [plan]))->setChargeId((int) request('charge_id'))->activate();

@return object
Activates a plan to the shop .