I have successfully integrated stripe payment. However, when I pass hardcoded amount and currency it works fine, but as I use variable in the charge array it gives me HTTP ERROR 500
My code:
<?php
require_once "config.php";
session_start();
$depoamount=$_SESSION['stripeamount'];
$curr=$_SESSION['curr'];
$token = $_POST['stripeToken'];
$email = $_POST['stripeEmail'];
$custid=$_SESSION['reg_no'];
//$custid='123';
$id=$_POST['ID'];
/* $depoamount=1200;
$curr='inr';*/
$customer = \Stripe\Customer::create([
'email' => $email,
'source' => $token,
'customer'=> $custid,
]);
$charge = \Stripe\Charge::create([
'customer' => $customer->id,
'amount' => $depoamount,// If I use '5000' it works
'currency' => $curr,// same if I put 'usd' it works
]);
echo '<h1>Successfully charged</h1>';
echo $charge->email;
echo $charge->id;
echo $custid;
?>
I think syntax is ok , however its not working.