Laravel\Cashier\Billable::charge PHP Method

charge() public method

Make a "one off" charge on the customer for the given amount.
public charge ( integer $amount, array $options = [] ) : Transaction
$amount integer
$options array
return Braintree\Transaction
    public function charge($amount, array $options = [])
    {
        $customer = $this->asBraintreeCustomer();
        $response = BraintreeTransaction::sale(array_merge(['amount' => $amount * (1 + $this->taxPercentage() / 100), 'paymentMethodToken' => $customer->paymentMethods[0]->token, 'options' => ['submitForSettlement' => true], 'recurring' => true], $options));
        if (!$response->success) {
            throw new Exception('Braintree was unable to perform a charge: ' . $response->message);
        }
        return $response;
    }