|
|
@@ -18,8 +18,8 @@ class BillingController extends Controller |
|
|
|
|
|
|
|
|
|
|
|
public function __construct() { |
|
|
|
$this->stripe = new \Stripe\StripeClient(env('STRIPE_SECRET')); |
|
|
|
Stripe::setApiKey(env('STRIPE_SECRET')); |
|
|
|
$this->stripe = new \Stripe\StripeClient(config('services.stripe.secret')); |
|
|
|
Stripe::setApiKey(config('services.stripe.secret')); |
|
|
|
$this->user = Auth::user(); |
|
|
|
} |
|
|
|
|
|
|
@@ -28,8 +28,6 @@ class BillingController extends Controller |
|
|
|
//was bought later. |
|
|
|
//Should validate that all amounts are positive integers in a reasonable range |
|
|
|
public function secret(Request $request) { |
|
|
|
Stripe::setApiKey(env('STRIPE_SECRET')); |
|
|
|
|
|
|
|
$user = Auth::user(); |
|
|
|
$amount = $request->packs[ 'credits10' ]*1099 + |
|
|
|
$request->packs[ 'credits50' ]*5499 + $request->packs[ 'credits100' ]*10999 |
|
|
@@ -71,8 +69,6 @@ class BillingController extends Controller |
|
|
|
} |
|
|
|
|
|
|
|
public function getCards() { |
|
|
|
Stripe::setApiKey(env('STRIPE_SECRET')); |
|
|
|
|
|
|
|
return PaymentMethod::all([ |
|
|
|
'customer' => Auth::user()->customer_id, |
|
|
|
'type' => 'card' |
|
|
@@ -80,7 +76,6 @@ class BillingController extends Controller |
|
|
|
} |
|
|
|
|
|
|
|
public function chargeEvent(Request $request) { |
|
|
|
Stripe::setApiKey(env('STRIPE_SECRET')); |
|
|
|
$event = \Stripe\Event::constructFrom($request->all()); |
|
|
|
$charge = $event->data->object; |
|
|
|
$transaction = Transaction::where('intent_id', $charge->payment_intent); |
|
|
|