Created
June 28, 2018 06:51
-
-
Save studio-fars-company/7bda2ee9cdde3ddbfe08ab6b9980ecfa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function showdirectcharge(){ | |
$user = User::all()->where('stripe_user_id', '!==', ""); | |
return view('directcharge')->with('user',$user); | |
} | |
public function directcharge(Request $request){//direct charge | |
try { | |
Stripe::setApiKey(env('STRIPE_SECRET')); | |
$customer = Customer::create(array( | |
'email' => $request->stripeEmail, | |
)); | |
$iddata = $request->iddata;//投稿者のid | |
$postuser = User::find($iddata); | |
$acct = $postuser->stripe_user_id; | |
$charge = Charge::create(array( | |
'amount' => 1000, | |
'currency' => 'jpy', | |
"application_fee" => 500, | |
"source" => $request->stripeToken, | |
),array( | |
"stripe_account" => $acct | |
) | |
); | |
return 'Direct Charge successful!'; | |
} catch (\Exception $ex) { | |
return $ex->getMessage(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment