当我使用信用卡运行付款代码时,我得到以下给出的错误?

时间:2016-12-03 09:56:34

标签: php stripe-payments payment-gateway credit-card

错误是

  

致命错误:未捕获Stripe_ApiConnectionError:无法连接   条纹(https://api.stripe.com)。请检查您的互联网连接   然后再试一次。如果这个问题仍然存在,请告诉我们   support@stripe.com。 (网络错误[错误6]:无法解析主机:   api.stripe.com)in   C:\ XAMPP \ htdocs中\ smilingfeetafrica \的信用卡\ lib中\条纹\ ApiRequestor.php:220   堆栈跟踪:#0   C:\ XAMPP \ htdocs中\ smilingfeetafrica \的信用卡\ lib中\条纹\ ApiRequestor.php(194):   Stripe_ApiRequestor-> handleCurlError(6,'无法解析...')#1   C:\ XAMPP \ htdocs中\ smilingfeetafrica \的信用卡\ lib中\条纹\ ApiRequestor.php(123):   Stripe_ApiRequestor-> _curlRequest('post','https://api.str ...',Array,   数组)#2   C:\ XAMPP \ htdocs中\ smilingfeetafrica \的信用卡\ lib中\条纹\ ApiRequestor.php(73):   Stripe_ApiRequestor-> _requestRaw('post','/ v1 / customers',Array)#3   C:\ XAMPP \ htdocs中\ smilingfeetafrica \的信用卡\ lib中\条纹\ ApiResource.php(76):   Stripe_ApiRequestor-> request('post','/ v1 / custo in   C:\ XAMPP \ htdocs中\ smilingfeetafrica \的信用卡\ LIB \条\ ApiRequestor.php   在第220行

index.php

<?php require_once('./config.php'); ?>
<html>
<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-name="Smiling Feet Africa";
          data-amount="6000"
          data-label="Donate Now";
          data-description="Donation To Smiling Feet Africa";
          data-image="https://scontent.fdel1-1.fna.fbcdn.net/v/t1.0-9/15267710_1800934823517876_8537040350463715708_n.jpg?oh=c28d57192ddfff07dfcdf2e09bed10da&oe=58B7699D";
          data-locale="auto"></script>
</form>
</html>

config.php

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

$stripe = array(
  "secret_key"      => "sk_test_iiL4w4FTUReerKcuW6O4hDMu",
  "publishable_key" => "pk_test_MyunyEF75C8aFGTA2S483IIQ"
);

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

charge.php

<?php
  require_once(dirname(__FILE__).'/config.php');

  $token  = $_POST['stripeToken'];

  $customer = Stripe_Customer::create(array(
      'email' => 'customer@example.com',
      'source'  => $token
  ));

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

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

我在localhost上运行。请帮助我。

0 个答案:

没有答案
相关问题