エンジニアリングは初心者です。
前提・実現したいこと
WordPressで簡単なECサイトを作っています。
決済手段はstripeを導入しています。
各投稿(商品)ごとに異なる金額を決済する機能を実装中に以下のエラーメッセージが発生しました。
発生している問題・エラーメッセージ
このページは動作していません kickoff.boy.jp では現在このリクエストを処理できません。 HTTP ERROR 500
該当のソースコード
投稿のページ
WordPress
1<form action="http://hogehoge.jp/fugafuga/wp-content/themes/fukasawa/checkout.php" method="POST"> 2 <script src="https://checkout.stripe.com/checkout.js" 3 class="stripe-button" 4 data-key="pk_test_aL3mGZSDdzmgfvXMelJOu1k3" 5 data-amount=<?php the_field('price');?> 6 data-description=<?php the_title_attribute(); ?> 7 data-image="https://stripe.com/img/documentation/checkout/marketplace.png" 8 data-locale="auto" 9 data-currency="jpy" 10 data-zip-code="false" 11 data-allow-remember-me="false" 12 data-label="Buy it now"></script> 13<input type="hidden" name="amount" value="<?php the_field('price');?>"/> 14</form>
checkout.php
<?php require_once( dirname(__FILE__).'/lib/stripe-php-5.8.0/init.php'); // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey("sk_test_VhCNshQKyceCbfU5Ds7YuOjr"); // Token is created using Stripe.js or Checkout! // Get the payment token submitted by the form: $token = $_POST['stripeToken']; $email = $_POST['stripeEmail']; $amount = $_POST['amount']; //データの受取 try { $charge = \Stripe\Charge::create(array( "amount" => $amount , "currency" => "jpy", "source" => $token, )); }catch (\Stripe\Error\Card $e) { // 決済できなかったときの処理 die('決済が完了しませんでした'); } ?>
補足情報
以下のプラグインをアクティブにしております。
・Advanced Custom Fields
・Contact Form 7
・EWWW Image Optimizer
・Google XML Sitemaps
回答よろしく願いいたします。
あなたの回答
tips
プレビュー