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
// アクセストークン発行 | |
Route::get('/redirect', function (Request $request) { | |
$request->session()->put('state', $state = Str::random(40)); | |
$query = http_build_query([ | |
'client_id' => '{client_id}', | |
'redirect_uri' => 'http://127.0.0.1:8000/callback', | |
'response_type' => 'code', | |
'scope' => ['read','write'], | |
'state' => $state, |
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
<?php | |
//Composerでstripe/stripe-php をrequire済み | |
require_once __FILE__. './jp.php'; | |
try{ | |
Stripe\Stripe::setApiKey('sk_test_YOUR_KEY'); | |
Stripe\Charge::create([]); | |
}catch(Stripe\Error\Base $e) { | |
$err = $e->getJsonBody()['error']; | |
if(key_exists('code', $err)) { |