Scalr_Billing::applyCoupon PHP Method

applyCoupon() public method

public applyCoupon ( $code )
    public function applyCoupon($code)
    {
        /*
        $customCoupon = $this->db->GetOne("SELECT chargify_coupon_id FROM billing.coupons WHERE id = ? AND scalr_account_id IS NULL LIMIT 1", array($code));
        if ($customCoupon) {
            $origCode = $code;
            $code = $customCoupon;
        }
        */
        $retval = $this->chargify->applyCoupon($this->subscriptionId, $code);
        //$this->db->Execute("UPDATE billing.coupons SET scalr_account_id = ? WHERE id = ?", array($this->account->id, $origCode));
        return $retval;
    }

Usage Example

Example #1
0
 public function xApplyCouponCodeAction()
 {
     $this->billing->applyCoupon($this->getParam('couponCode'));
     $this->response->success("Coupon successfully applied to your subscription");
 }