【发布时间】:2017-07-03 03:17:06
【问题描述】:
在完成对结帐弹出窗口的输入后,任何人都可以协助说明为什么这没有发布到预订/收费?
简单的结帐示例帖子很好,我是 js 新手,所以我不太了解命令的流程。
<form action="/booking/charge" method="post">
<script src="https://checkout.stripe.com/checkout.js"></script>
<button id="customButton">Purchase</button>
<script>
var handler = StripeCheckout.configure({
key: 'pk_test_xxxxxxxxxxx',
image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
locale: 'auto',
token: function(token) {
// You can access the token ID with `token.id`.
// Get the token ID to your server-side code for use.
}
});
document.getElementById('customButton').addEventListener('click', function(e) {
// Open Checkout with further options:
handler.open({
name: 'xxxx',
email: "test@test.com",
description: '2 widgets',
currency: 'gbp',
amount: 350
});
e.preventDefault();
});
// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
handler.close();
});
</script>
</form>
【问题讨论】:
-
拜托,每个帖子都问一个问题,很难在一个线程中回答多个问题。这段代码到底有什么问题?
-
@Eduard Malakhov 完成对结帐弹出窗口的输入后,弹出窗口关闭并返回到同一页面,而不是像我认为应该那样完成到预订/收费页面的帖子.当我在表单标签中有简单结账的脚本时,在完成对结账弹出窗口的输入后,它完成了预订/收费的发布。我不明白为什么它不与自定义结帐?
标签: javascript php post stripe-payments