0
我試圖在我的網站中實施條形支付,以便客戶可以自行收取金額。條紋文件不是直接的,整合困難。自動輸入條形支付的收費金額
<form action="charge.php" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_xxxxxxxxxxxxxxxxxxxx"
data-amount="CHARGE AMOUNT"
data-name="Maid In Raleigh"
data-description="Service Charge"
data-image="/128x128.png">
</script>
</form>
我希望我的客戶更改「數據量」,以便他們可以更改付款的價值。我確信下面給出的charge.php是一團糟。儘管儀表板將令牌註冊到他們的日誌文件中,但我無法使其工作。
<?php
\Stripe\Stripe::setApiKey("sk_test_xxxxxxxxxxxxxxxxxxxxxxx");
// Get the credit card details submitted by the form
$token = $_POST['stripeToken'];
// Create the charge on Stripe's servers - this will charge the user's card
try {
$charge = \Stripe\Charge::create(array(
"amount" => CHARGEAMOUNT, // amount in cents, again
"currency" => "usd",
"source" => $token,
"description" => "Service Charge")
);
echo "<h2>Thank you!</h2>"
echo $_POST['stripeEmail'];
} catch(\Stripe\Error\Card $e) {
// The card has been declined
}
echo "<h2>Thank you!</h2>"
?>
有沒有什麼辦法可以避免從客戶端收費javascript,而是使用PHP來處理?
如果有人能幫忙,謝謝!
謝謝!讓我看看我能在這裏做什麼。我會回來讓你知道。 – 2015-04-03 00:52:06