[英]Setting up custom stripe checkout using the default stripe form
因此,我一直在尝试为我获取自定义条纹签出表格。 我无法使用简单版本,因为我需要能够更改要支付的金额以及每次购买的说明,而标准条纹结帐表单仅为这两个变量设置了值,无法更改。 但是,我不想使用自定义表单,我只想使用标准表单进行结帐。 我的问题是尝试将数据发送到服务器,我尝试了许多不同的方法,但似乎无法正常工作。 这是我的代码:
<p><input id="buy-submit-button" class="button" type="submit" value="チェックアウト"></input></p>
<script>
var handler = StripeCheckout.configure({
key: 'pk_test_g6do5S237ekq10r65BnxO6S0',
locale: 'auto',
token: function(token) {
//don't know what needs to go here
}
});
document.getElementById("buy-submit-button").addEventListener('click', function(e) {
setTimeout(function(){
var totalCost = 0;
var totalCartLoad = "";
totalCost = localStorage.getItem('totalCartPrice');
totalCartLoad = localStorage.getItem('whatsInCart');
totalCartLoad = totalCartLoad.replace('undefined','');
// Open Checkout with further options:
handler.open({
name: "チェックアウト",
description: totalCartLoad,
shippingAddress: true,
billingAddress: true,
zipCode: true,
allowRememberMe: true,
currency: 'JPY',
amount: totalCost
});
e.preventDefault();
}, 500);
});
// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
handler.close();
});
</script>
因此,我再次重申这一点。 我所要做的就是使用按条状默认表格,当您按下按钮然后将其提交到服务器时会弹出该表格,正确的方法是什么?
我能够使用此处另一个问题的答案来解决这个问题: make-stripe-data-amount-use-a-dynamic-a-variables
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.