这是我的 checkout.php 页面。我看不到此表单提交费用将在条带上发生。
<div class="row">
<div class='col-sm-offset-9 col-sm-3'>
<form action="process.php" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_Ccg6bLuZ261haQizFhV8Ma9k"
data-amount="<?php echo $amount?>"
data-name="Skarten.com"
data-description="Widget"
data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
data-shipping-address="true"
data-email="<?php echo $user->get_email()?>"
data-locale="auto">
</script>
</form>
</div>
</div>
这是我的 process.php。但我的问题是如何从条纹获得任何确认。如果收费成功与否。
session_start();
// 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
require_once('stripe-php/init.php');// add the php library for stripe
\Stripe\Stripe::setApiKey("sk_test_8UDgizhVo91Z8MJqk7G9n9BN");
// Token is created using Checkout or Elements!
// Get the payment token ID submitted by the form:
$token = $_POST['stripeToken'];
$amount=$_SESSION['amount'];
// Charge the user's card:
$charge = \Stripe\Charge::create(array(
"amount" => $amount,
"currency" => "usd",
"description" => "Example charge",
"metadata" => array("order_id" => 6735),
"source" => $token,
));