php charge.php

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php charge.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-amount="5000" data-description="One year's subscription"></script>
</form>
<?php
require_once('vendor/autoload.php');

$stripe = array(
  secret_key      => "sk_test_332kjf2jkewkw",
  publishable_key => "pk_test_n32ikj323k2kf"
);

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

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

  $token  = $_POST['stripeToken']; // retrieve stripeToken POST parameter to charge the card

  $customer = \Stripe\Customer::create(array(
      'email' => $_POST['stripeEmail'],
      'card'  => $token
  ));

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

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

以上是关于php charge.php的主要内容,如果未能解决你的问题,请参考以下文章

条纹结帐自定义按钮不充电

linux 安装多个PHP版本(php5.6 php7.1 php7.2 php7.3 php7.4 php8.0)nginx配置php多版本

php [guzzle php] guzzle php #php

php send.php php邮件模板#php

IntelliJ IDEA 11编辑php是,支持php文件名为.php5和.php4,如何设置能让其也支持.php呢?

如何从php5升级到php7