Reputation: 107
I add a Stripe SDK for the payment gateway. which works fine when I enter the correct card details. but if I enter the wrong card details like enter the wrong card number it doesn't show me any response. when I try to understand I found that when I enter the wrong card details it doesn't create a token. I think that's the problem but I need help to find out why stripe doesn't show me any response in PHP. during wrong card details.
here is my PHP code:-
if(isset($_REQUEST)){
$cardno = $_POST['cardno'];
$cardname = $_POST['cardno';
$cardmonth = $_POST['cardmonth'];
$cardyear = $_POST['cardyear'];
$cardcvv = $_POST['cardcvv'];
require_once('vendor/autoload.php');
$stripeSecret = 'strpe_api_key';
\Stripe\Stripe::setApiKey($stripeSecret);
$token = \Stripe\Token::create(array(
"card" => array(
"number" => $cardno,
"exp_month" => $cardmonth,
"exp_year" => $cardyear,
"cvc" => $cardcvv
)
));
//echo "10";
$charge = \Stripe\Charge::create(array(
[
'description' => "Package Subscription",
'shipping' => [
'name' => 'sam',
'phone'=> '0123456789',
'address' => [
'line1' => '510 Townsend St',
'postal_code' => '98140',
'city' => 'San Francisco',
'state' => 'CA',
'country' => 'US',
],//address ands
],//shipping ends
'amount' => round(10.00 * 100),
'currency' => 'usd',
"source" => $token,
]
));
}
Anyone know how check this so please help me out.
Upvotes: 0
Views: 79