src/ShopifyApp/Services/UsageCharge.php
public function activate()
    {
        // Ensure we have a recurring charge
        $currentCharge = $this->shop->planCharge();
        if (!$currentCharge->isType(Charge::CHARGE_RECURRING)) {
            throw new Exception('Can only create usage charges for recurring charge.');
        }

        $this->response = $this->api->rest(
            'POST',
            "/admin/recurring_application_charges/{$currentCharge->charge_id}/usage_charges.json",
            [
                'usage_charge' => [
                    'price'       => $this->data['price'],
                    'description' => $this->data['description'],
                ],
            ]
        )->body->usage_charge;

        return $this->response;
    }
public function activate()
    {
        // Ensure we have a recurring charge
        $currentCharge = $this->shop->planCharge();
        if (!$currentCharge->isType(Charge::CHARGE_RECURRING)) {
            throw new Exception('Can only create usage charges for recurring charge.');
        }

        $this->response = $this->api->rest(
            'POST',
            "/admin/recurring_application_charges/{$currentCharge->charge_id}/usage_charges.json",
            [
                'usage_charge' => [
                    'price'       => $this->data['price'],
                    'description' => $this->data['description'],
                ],
            ]
        )->body->usage_charge;

        return $this->response;
    }
public function activate ( ) { // Ensure we have a recurring charge $ currentCharge = $ this -> shop -> planCharge ( ) ; if ( ! $ currentCharge -> isType ( Charge :: CHARGE_RECURRING ) ) { throw new Exception ( 'Can only create usage charges for recurring charge.' ) ; } $ this -> response = $ this -> api -> rest ( 'POST' , "/admin/recurring_application_charges/{$currentCharge->charge_id}/usage_charges.json" , [ 'usage_charge' => [ 'price' => $ this -> data [ 'price' ] , 'description' => $ this -> data [ 'description' ] , ] , ] ) -> body -> usage_charge ; return $ this -> response ; }
Activates the usage charge.

@return object
Activates the usage charge .