Hi guys,
I am trying to charge the customer 2 times and I want to proceed the 2nd payment with Laravel queue but I am not sure what needs to be done in the Job that i created.
This is my controller:
public function StripeCharge(Request $request) {
$product_name = $request->product_name;
$product_price = $request->product_price;
Stripe\Stripe::setApiKey(env('STRIPE_SECRET'));
$customer = \Stripe\Customer::create(array(
"email" => $email = Auth::user()->email,
"source" => $request->stripeToken
));
$mailInfo = \Stripe\Charge::create(array(
"amount" => $product_price * 100,
"currency" => "gbp",
"customer" => $customer->id,
"description" => "Deposit" . "-" . $product_name
));
$newcustomer = $customer->id;
$email = Auth::user()->email;
Mail::to($email)->send(new WelcomeMail($mailInfo));
$fullamount = New ChargeCustomer($mailInfo);
dispatch($fullamount)->delay(now()->addMinutes(5));
return view('confirmation');
}
This is my ChargeCustomer job
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class ChargeCustomer implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $fullamount;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($fullamount)
{
$fullamount = $this->fullamount;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
}
}
Any help will be much appreciated. Thank you very much in advance.