lib/AktiveMerchant/Billing/Gateways/FatZebra.php
public function recurring($plan, CreditCard $creditcard, $options = array())
    {
        $this->post = array();

        Options::required('first_name, last_name, email, customer_id, start_date, period', $options);

        $options = new Options($options);

        if (null === $options->customer_id) {
            $response = $this->createCustomer($creditcard, $options);
            $customer_id = $response->params()->id;
        } else {
            $customer_id = $options->customer_id;
        }

        $this->post['customer'] = $customer_id;
        $start_date = $options->start_date instanceof \DateTime ? $options->start_date : new \DateTime(strtotime($options->start_date));
        $this->post['start_date'] = $start_date->format('Y-m-d');
        $this->post['plan'] = $plan;
        $this->post['frequency'] = $options->period;
        $this->post['is_active'] = true;
        $this->post['reference'] = $options->customer_id;

        return $this->commit('subscriptions');
    }
public function recurring($plan, CreditCard $creditcard, $options = array())
    {
        $this->post = array();

        Options::required('first_name, last_name, email, customer_id, start_date, period', $options);

        $options = new Options($options);

        if (null === $options->customer_id) {
            $response = $this->createCustomer($creditcard, $options);
            $customer_id = $response->params()->id;
        } else {
            $customer_id = $options->customer_id;
        }

        $this->post['customer'] = $customer_id;
        $start_date = $options->start_date instanceof \DateTime ? $options->start_date : new \DateTime(strtotime($options->start_date));
        $this->post['start_date'] = $start_date->format('Y-m-d');
        $this->post['plan'] = $plan;
        $this->post['frequency'] = $options->period;
        $this->post['is_active'] = true;
        $this->post['reference'] = $options->customer_id;

        return $this->commit('subscriptions');
    }
public function recurring ( $ plan , CreditCard $ creditcard , $ options = array ( ) ) { $ this -> post = array ( ) ; Options :: required ( 'first_name, last_name, email, customer_id, start_date, period' , $ options ) ; $ options = new Options ( $ options ) ; if ( null === $ options -> customer_id ) { $ response = $ this -> createCustomer ( $ creditcard , $ options ) ; $ customer_id = $ response -> params ( ) -> id ; } else { $ customer_id = $ options -> customer_id ; } $ this -> post [ 'customer' ] = $ customer_id ; $ start_date = $ options -> start_date instanceof \ DateTime ? $ options -> start_date : new \ DateTime ( strtotime ( $ options -> start_date ) ) ; $ this -> post [ 'start_date' ] = $ start_date -> format ( 'Y-m-d' ) ; $ this -> post [ 'plan' ] = $ plan ; $ this -> post [ 'frequency' ] = $ options -> period ; $ this -> post [ 'is_active' ] = true ; $ this -> post [ 'reference' ] = $ options -> customer_id ; return $ this -> commit ( 'subscriptions' ) ; }
Creates a recurring billing subscription for a customer.

Available options for period are: "Daily", "Weekly", "Fortnightly", "Monthly", "Quarterly", "Bi-Annually", "Annually"

start_date can be a DateTime object a timestamp or a string the can be
parsed via strtime function.

customer_id can be a string with id returned when you created a customer (XXX-C-XXXXXXXX).
if customer_id ommited then a new customer will be cteated.

@param string     $plan The plan id returned when you created a plan (XXX-PL-XXXXXXXX).
@param CreditCard $creditcard
@param array      $options

@access public
@return void
Creates a recurring billing subscription for a customer .