Stripe の「Pay with Card」チェックアウトをバックボーン Node 環境に統合しようとしています。サーバー側では、Stripe Node コードを使用しています。その部分はうまく機能します。ただし、クライアント側では、イベントをキャプチャできません。
ビューで「支払い請求」メソッドを呼び出すために、ストライプポップアップから送信イベントをキャプチャしたいと思います。
これが私のコードです:
<!-- Stripe Payments Form Template -->
<form id="stripepaymentform" class="paymentformclass">
<script
src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button"
data-key="pk_test_xxxxxxxxxxxxx"
data-amount="0299"
data-name="MyDemo"
data-description="charge for something"
data-image="assets\ico\icon-72.png">
</script>
</form>
バックボーン ビュー クラス
myprog.PaymentPanelView = Backbone.View.extend({
initialize: function () {
this.render();
},
render: function () {
$(this.el).html(this.template());
return this;
},
events : {
"submit" : "paymentcharge"
},
paymentcharge : function( event) {
this.model.set({stripeToken: stripeToken});
}
});
バックボーン モデル クラス
var PaymentChargeModel = Backbone.Model.extend({
url: function(){
return '/api/paymentcharge';
},
defaults: {
}
})
View from header menu イベントの設定/呼び出し
if (!this.paymentPanelView) {
this.paymentPanelView = new PaymentPanelView({model: new PaymentChargeModel()});
}
$('#content').html(this.paymentPanelView.el);
this.paymentPanelView.delegateEvents();
this.selectMenuItem('payment-menu');