Exemplo n.º 1
0
 public function boot()
 {
     require 'vendor/autoload.php';
     Stripe\Stripe::setApiKey(Settings::instance()->api_key);
     if (Input::has('stripeToken') && Input::has('product_id')) {
         $product = Product::find(Input::get('product_id'));
         try {
             $charge = \Stripe\Charge::create(array("amount" => preg_replace('/[.]/', '', $product->price), "currency" => "usd", "source" => Input::get('stripeToken'), "description" => "*****@*****.**"));
         } catch (\Stripe\Error\Card $e) {
             // The card has been declined
         }
     }
 }
Exemplo n.º 2
0
 public function api_key()
 {
     return Settings::instance()->api_key_publishable;
 }