我一直有麻煩整合條紋到我的網站,因爲它似乎每次我解決問題時出現一個不同的問題。PHP條紋集成
我決定使用本地條紋文件夾庫而不是安裝它。
我的團購頁面看起來是這樣的:
<body>
<?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>
</body>
我charge.php看起來是這樣的:
<?php
require_once('./config.php');
$token = $_POST['stripeToken'];
$customer = \Stripe\Customer::create(array(
'email' => '[email protected]',
'source' => $token
));
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => 5000,
'currency' => 'usd'
));
echo '<h1>Successfully charged $50.00!</h1>';
?>
最後,我的config.php文件:(星取代了我的鑰匙)
<?php
require_once('./Stripe/init.php');
$stripe = array(
"secret_key" => "sk_test_***********************",
"publishable_key" => "pk_test_***********************"
);
\Stripe\Stripe::setApiKey($stripe['secret_key']);
我的條紋庫文件夾與我的其他頁面處於同一水平,這可能是我的問題,爲了展示這一點,我將製作一個漸變d符號列表:
- 的config.php
- 的index.php
- charge.php
- 條紋(文件夾)
- 內容在文件夾
什麼我做錯了嗎?我已經上傳的文件夾到我的虛擬主機提供商的服務器,當我去到那裏應該是一個按鈕的頁面,我收到一個錯誤:
Warning: require(/home1/desmoriz/public_html/Stripe/lib/AttachedObject.php): failed to open stream: No such file or directory in /home1/desmoriz/public_html/Stripe/init.php on line 32
Fatal error: require(): Failed opening required '/home1/desmoriz/public_html/Stripe/lib/AttachedObject.php' (include_path='.:/opt/php56/lib/php') in /home1/desmoriz/public_html/Stripe/init.php on line 32