【发布时间】:2019-02-01 08:15:32
【问题描述】:
我正在使用 Stripe,并根据该页面创建了一个 custom checkout:
var handler = StripeCheckout.configure({
key: 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
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: 'some name',
description: '2 widgets',
currency: 'aud',
amount: 2000
});
e.preventDefault();
});
// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
handler.close();
});
但是我想知道是否有任何方法可以更新传递给open 的配置选项,因为我需要在用户进行更改时更新amount。
...或者我最好的选择是重新启动它的全部或部分?
虽然这段代码是在 vanilla JavaScript 中,但我已将其更改为 jQuery,因此首选 jQuery 解决方案。
【问题讨论】:
标签: javascript jquery stripe-payments