/** * Create this charge in the billing gateway. * * @param int $amount * @param array $properties * * @return Charge */ public function create($amount, array $properties = array()) { if (!$this->model->readyForBilling()) { if ($this->card_token) { $this->model->billing()->withCardToken($this->card_token)->create($properties); if (!empty($this->model->billing_cards)) { $this->card_token = null; } } else { $this->model->billing()->create($properties); } } if ($this->card_token) { $this->card = $this->model->creditcards()->create($this->card_token)->id; $this->card_token = null; } $gateway_charge = \LinkThrow\Billing\Facades\Billing::charge(null, $this->model->gatewayCustomer())->create($amount, array_merge($properties, array('card_token' => $this->card_token, 'card' => $this->card))); return new Charge($this->model, $gateway_charge); }