Skip to content

Instantly share code, notes, and snippets.

View belltzel's full-sized avatar

Yousuke Hayashi belltzel

View GitHub Profile
// アクセストークン発行
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,
@belltzel
belltzel / Example.php
Last active September 17, 2020 21:39 — forked from sandabu/Example.php
Stripe API Japanese Error Messages
<?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)) {