src/ShopifyApp/Services/UsageCharge.php
public function save()
    {
        if (!$this->response) {
            throw new Exception('No activation response was recieved.');
        }

        // Get the plan charge
        $planCharge = $this->shop->planCharge();

        // Create the charge
        $charge = new Charge();
        $charge->type = Charge::CHARGE_USAGE;
        $charge->reference_charge = $planCharge->charge_id;
        $charge->shop_id = $this->shop->id;
        $charge->charge_id = $this->response->id;
        $charge->price = $this->response->price;
        $charge->description = $this->response->description;
        $charge->billing_on = $this->response->billing_on;

        return $charge->save();
    }
public function save()
    {
        if (!$this->response) {
            throw new Exception('No activation response was recieved.');
        }

        // Get the plan charge
        $planCharge = $this->shop->planCharge();

        // Create the charge
        $charge = new Charge();
        $charge->type = Charge::CHARGE_USAGE;
        $charge->reference_charge = $planCharge->charge_id;
        $charge->shop_id = $this->shop->id;
        $charge->charge_id = $this->response->id;
        $charge->price = $this->response->price;
        $charge->description = $this->response->description;
        $charge->billing_on = $this->response->billing_on;

        return $charge->save();
    }
public function save ( ) { if ( ! $ this -> response ) { throw new Exception ( 'No activation response was recieved.' ) ; } // Get the plan charge $ planCharge = $ this -> shop -> planCharge ( ) ; // Create the charge $ charge = new Charge ( ) ; $ charge -> type = Charge :: CHARGE_USAGE ; $ charge -> reference_charge = $ planCharge -> charge_id ; $ charge -> shop_id = $ this -> shop -> id ; $ charge -> charge_id = $ this -> response -> id ; $ charge -> price = $ this -> response -> price ; $ charge -> description = $ this -> response -> description ; $ charge -> billing_on = $ this -> response -> billing_on ; return $ charge -> save ( ) ; }
Saves the usage charge to the database.

@return bool
Saves the usage charge to the database .