Php 如何创建带条签出页面的url?

Php 如何创建带条签出页面的url?,php,stripe-payments,Php,Stripe Payments,我使用以下代码创建按钮,以条带化签出页面: \Stripe\Stripe::setApiKey($stripe['secret_key']); $session = \Stripe\Checkout\Session::create([ 'payment_method_types' => ['card'], 'line_items' => [[ 'price_data' => [ 'currency' => 'usd', 'prod

我使用以下代码创建按钮,以条带化签出页面:

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

$session = \Stripe\Checkout\Session::create([
  'payment_method_types' => ['card'],
  'line_items' => [[
    'price_data' => [
      'currency' => 'usd',
      'product_data' => [
        'name' => 'T-shirt',
      ],
      'unit_amount' => 2000,
    ],
    'quantity' => 1,
  ]],
  'mode' => 'payment',
  'success_url' => 'https://example.com/success',
  'cancel_url' => 'https://example.com/cancel',
]);
?>


<script src="https://js.stripe.com/v3/"></script>


<a href="#" id="checkout-button">BUY</a>


<script type="text/javascript">  
var stripe = Stripe('xxxx');
var checkoutButton = document.getElementById('checkout-button');
checkoutButton.addEventListener('click', function() {
  stripe.redirectToCheckout({
    sessionId: '<?=$session['id'];?>'
  }).then(function (result) {
  });
});
</script>
\Stripe\Stripe::setApiKey($Stripe['secret\u key']);
$session=\Stripe\Checkout\session::create([
“付款方式类型”=>[“卡”],
“行项目”=>[[
“价格数据”=>[
“货币”=>“美元”,
“产品数据”=>[
“姓名”=>“T恤”,
],
“单位金额”=>2000,
],
“数量”=>1,
]],
“模式”=>“付款”,
'success_url'=>'https://example.com/success',
'取消url'=>'https://example.com/cancel',
]);
?>
变量条带=条带('xxxx');
var checkburatton=document.getElementById('checkout-button');
CheckExutton.addEventListener('单击',函数()){
stripe.redirectToCheckout({
会话ID:“”
}).然后(函数(结果){
});
});
如何创建直接url到条带化签出页面,如$checkout\uURL=

我需要和聊天机器人一起使用,而我不能使用JS


谢谢你的帮助

目前,签出需要使用Stripe.js重定向客户端。你不能直接从服务器重定向,这就是为什么你当时看不到url的原因。我只需要生成url并将其设置为chatbot PAY按钮。我理解,目前这根本不可能,签出需要使用Stripe.js重定向客户端。你不能直接从服务器重定向,这就是为什么你看不到url的原因。我只需要生成url并将其设置为chatbot付费按钮。我理解,这在目前是不可能的