Stripe, токен не генерируется на Live Server, на Local работает нормально - PullRequest
0 голосов
/ 07 июня 2018

как заголовок у меня странная проблема.Я пытался интегрировать платежный шлюз Stripe на свой веб-сайт, но проблема в том, что токен не генерируется на Live Server, в то время как на локальной машине он работает просто отлично ...

Мой код:

/*index.php*/
<?php
  require_once('config.php');
?>

<form action="charge.php" method="post">
  <script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
          data-key="<?php echo $stripe['publishable_key']; ?>"
          data-description="Access for a year"
          data-amount="5000"
          data-locale="auto">
  </script>
</form>

/*config.php*/

<?php
  require_once('stripe/init.php');

  $stripe = array(
    "secret_key"      => "sk_test_lcnCLz5lnSWPzhMRMOhjGcXD",
    "publishable_key" => "pk_test_KW35E5D3ShuLfvd60VHrRVJQ"
  );

  \Stripe\Stripe::setApiKey($stripe['secret_key']);
?>

/*charge.php*/

<?php
  require_once('config.php');

  $token  = $_POST['stripeToken'];
  $email  = $_POST['stripeEmail'];

  $customer = \Stripe\Customer::create(array(
      'email' => $email,
      'source'  => $token
  ));

  $charge = \Stripe\Charge::create(array(
      'customer' => $customer->id,
      'amount'   => 5000,
      'currency' => 'usd'
  ));

  echo '<h1>Successfully charged $50.00!</h1>';
?>
...