diff --git a/lib/recurly/subscription.php b/lib/recurly/subscription.php index 0c75fd6e..e0112726 100644 --- a/lib/recurly/subscription.php +++ b/lib/recurly/subscription.php @@ -103,24 +103,31 @@ public function updateAtRenewal() { /** * Terminate the subscription immediately and issue a full refund of the last renewal + * + * @param Boolean charge If true, unbilled usage is billed on final invoice, else negative usage record created to zero out final invoice. */ - public function terminateAndRefund() { - $this->terminate('full'); + public function terminateAndRefund($charge = true) { + $this->terminate('full', $charge); } /** * Terminate the subscription immediately and issue a prorated/partial refund of the last renewal + * + * @param Boolean charge If true, unbilled usage is billed on final invoice, else negative usage record created to zero out final invoice. */ - public function terminateAndPartialRefund() { - $this->terminate('partial'); + public function terminateAndPartialRefund($charge = true) { + $this->terminate('partial', $charge); } /** * Terminate the subscription immediately without a refund + * + * @param Boolean charge If true, unbilled usage is billed on final invoice, else negative usage record created to zero out final invoice. */ - public function terminateWithoutRefund() { - $this->terminate('none'); + public function terminateWithoutRefund($charge = true) { + $this->terminate('none', $charge); } - private function terminate($refundType) { - $this->_save(Recurly_Client::PUT, $this->uri() . '/terminate?refund=' . $refundType); + private function terminate($refundType, $charge) { + $chargeString = ($charge) ? 'true' : 'false'; + $this->_save(Recurly_Client::PUT, $this->uri() . '/terminate?refund=' . $refundType . '&charge=' . $chargeString); } /**