我已成功使用PHP实现了Stripe Checkout。但我想要去掉初始的Stripe按钮,该按钮通常会显示“进入付款”或“用卡付款”。我只想将我的网站上的按钮链接直接到Checkout弹出窗口。我想知道这是否可能?我已经在下面包含了php文件和相关的html代码。
index.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-name="The Boffins"
data-amount="25000"
data-currency="GBP"
data-description="Social Package"
data-image="images/Gentleman.gif"
data-label="Proceed to Payment"
data-panel-label="Only">
</script>
</form>
charge.php
<?php
require_once('config.php');
$token = $_POST['stripeToken'];
$customer = \Stripe\Customer::create(array(
'email' => 'customer@example.com',
'card' => $token
));
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => 25000, //amount in pennies
'currency' => 'gbp'
));
echo 'Successfully charged £250! We will be in touch shortly.';
config.php
require_once('vendor/stripe-php-3.1.0/init.php');
$stripe = array(
"secret_key" => "sk_live_XXXXXXXXXXXX",
"publishable_key" => "pk_live_YYYYYYYYYYYY"
);
\Stripe\Stripe::setApiKey($stripe['secret_key']);
html:
<a class="button price-button one-off-m" href="index.php">£250 /<span class="one-off"></a>