Braintree\Transaction::sale PHP Method

sale() public static method

public static sale ( $attribs )
    public static function sale($attribs)
    {
        return Configuration::gateway()->transaction()->sale($attribs);
    }

Usage Example

 /**
  * Make a "one off" charge on the customer for the given amount.
  *
  * @param  int  $amount
  * @param  array  $options
  * @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;
 }
All Usage Examples Of Braintree\Transaction::sale