Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  2. $error = false;
  3. try {
  4. if (!isset($_POST['stripeToken'])) throw new Exception("The Stripe Token was not generated correctly");
  5. if (!isset($_POST['stripeEmail'])) throw new Exception("The Stripe Email was not received");
  6. $charge = \Stripe\Charge::create(array(
  7. 'source' => $_POST['stripeToken'],
  8. 'amount' => 3400,
  9. 'currency' => 'EUR',
  10. 'receipt_email' => $_POST['stripeEmail']
  11. ));
  12. } catch (Exception $e) {
  13. $error = $e->getMessage();
  14. }
  15. if (!$error) {
  16. echo "";
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement