0
У меня возникла проблема с Stripe, где она с радостью создаст токен и отправит его на мой скрипт загрузки php, после чего на панели управления Stripe будет создан журнал 200 OK - Token
. Он просто не будет взимать плату, насколько я вижу, я все сделал правильно, я не получаю никаких ошибок, в php или из интерфейса Stripe API.Полоса, не заряжающая карту
error_reporting(E_ALL);
ini_set('display_errors', 1);
$error = 0;
require_once('stripe-php-master/init.php');
$trialAPIKey = "sk_test_???"; // These are the SECRET keys!
$liveAPIKey = "sk_live_???";
\Stripe\Stripe::$apiBase = "https://api-tls12.stripe.com";
// Switch to change between live and test environments
\Stripe\Stripe::setApiKey($trialAPIKey);
/* \Stripe\Stripe::setApiKey($liveAPIKey); */
$token = $_POST['token'];
$price = $_POST['amount'];
$price = $price * 100;
$desc = $_POST['desc'];
try {
$charge = \Stripe\Charge::create(array(
"amount" => $price,
"currency" => "gbp",
"source" => $token,
"description" => $desc
));
} catch(\Stripe\Error\Card $e) {
// The card has been declined
$error++;
}
if($error>=1) {
echo "There was an error processing your card, please try again.";
} else {
echo "Thank you, your payment was successful.";
}