提交checkout.js表单时,this.fn不是函数

时间:2015-09-23 19:35:30

标签: javascript stripe-payments checkout

我在尝试提交条带结帐表单时收到错误。

enter image description here

这是我的代码:

<form method="POST" action="http://sugarcereal.com/bid" accept-charset="UTF-8">
<input name="_token" type="hidden" value="7GVWWPe71ETA9ApL7MZF03Hx3g0tAWRaJ4iWl0dS">

<div>
    <label for="url">URL</label>
   <input placeholder="url" name="url" type="text">
</div>
<div>
    <label for="bid_amount">Bid Amount</label>
    <input placeholder="bid_amount" name="bid_amount" type="text" value="200" id="bid_amount">
</div>

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

<button id="customButton">Purchase</button>

<script>
    var handler = StripeCheckout.configure({
    key: 'pk_test_my_key',
    image: 'logo.png',
    locale: 'auto'
  });

$('#customButton').on('click', function(e) {
// Open Checkout with further options
handler.open({
  name: 'Co. Name',
  description: 'Bid',
  amount: $('#bid_amount').val()
});
e.preventDefault();
});

// Close Checkout on page navigation
$(window).on('popstate', function() {
handler.close();
});
</script>
</div>
</form>

1 个答案:

答案 0 :(得分:1)

马修在上面作为评论回答。我错过了一个令牌回调函数。