Example #1
0
 /**
  * @param array|null $params
  *
  * @returns array An array of the customer's Stripe_Charges.
  */
 public function charges($params = null)
 {
     if (!$params) {
         $params = array();
     }
     $params['customer'] = $this->id;
     $charges = M2_Stripe_Charge::all($params, $this->_apiKey);
     return $charges;
 }
 /**
  * Creates a one-time charge that is immediately captured.
  *
  * This means the money is instantly transferred to our own stripe account.
  *
  * @since  1.0.0
  * @internal
  *
  * @param  M2_Stripe_Customer $customer Stripe customer to charge.
  * @param  float $amount Amount in currency (i.e. in USD, not in cents)
  * @param  string $currency 3-digit currency code.
  * @param  string $description This is displayed on the invoice to customer.
  * @return M2_Stripe_Charge The resulting charge object.
  */
 public function charge($customer, $amount, $currency, $description)
 {
     $charge = M2_Stripe_Charge::create(array('customer' => $customer->id, 'amount' => intval($amount * 100), 'currency' => strtolower($currency), 'description' => $description));
     return apply_filters('ms_gateway_stripe_charge', $charge, $customer, $amount, $currency, $description, $this);
 }