【发布时间】:2016-01-05 21:00:58
【问题描述】:
我使用 Brain-tree 作为支付网关。在那我正在使用插入式用户界面。 在 drop-in ui 中有一个选项更改付款方式。 当我更改付款方式时,它会更改但不会设置默认值。下次交易只取旧卡,不取新卡。
我的 js
<script>
$(document).ready(function() {
braintree.setup("{{ client_token }}", "dropin", {
container: "checkout",
form: "checkoutForm"
});
$("#submitPayment").on("click", function () {
$("button").off("click");
$("a").off("click");
$('body').off("click");
var btn = $(this).button("loading")
setTimeout(function () {
btn.button('reset');
}, 3500)
});
});
</script>
form.html
<form id='checkoutForm' method='POST' action="/upgrade/">{% csrf_token %}
<div id='checkout' ></div>
<input type="hidden" name="plan" value="{{ plan }}"/>
<input name="token" type="hidden" value="{{ client_token }}" />
<!-- disable this when clicked -->
<button type="button" class="btn modal-action modal-close right margin-class canceleledd"
style="display:none;background-color:lightcoral;color: #000000;">Cancel</button>
<input id='submitPayment' type='submit' data-loading-text="Completing..." class='btn right margin-class' value='Pay ${{ amount }}' autocomplete="off" style="background-color:lightblue;color: #000000;"/>
</form>
添加新卡时,我不知道如何将付款方式设置为默认值。 帮助将不胜感激。谢谢。
【问题讨论】:
标签: javascript python django payment-gateway braintree