Created
May 26, 2015 10:46
-
-
Save bran921007/64edb01d1ffeba38cf9f to your computer and use it in GitHub Desktop.
Stripe backend - PHP Laravel
This file contains hidden or 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
//use Stripe\Stripe; | |
\Stripe\Stripe::setApiKey('SECRET API KEY'); | |
$token = Input::get('token'); | |
$amount = Input::get('amount'); | |
try { | |
$charge = \Stripe\Charge::create(array('card' => $token, 'amount' => $amount, 'currency' => 'usd')); | |
} catch (Error\Card $e) { | |
return Response::json(array( | |
'status' => 'failed', | |
'msg' => 'sripe transaction invalid', | |
'error_msg' => $e->getMessage(), | |
'error_line_ubication' => $e->getLine(), | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment