【发布时间】:2016-08-22 06:56:06
【问题描述】:
我正在尝试将 Braintree Payments 插件集成到 Ionic 移动应用中。根据我在网上找到的 Braintree 文档和一些代码示例,以下代码是我迄今为止设法提出的,但它似乎不起作用:
controller.js
.controller('CheckoutForm', function($scope, $window) {
$scope.clientToken = "<token generated by the server>"
$scope.renderCheckout = function() {
braintree.setup($scope.clientToken, "dropin", {
container: "payment-form"
});
}
})
模板.html
<div>
Payment details:
<form id="checkout">
<div id="payment-form" onLoad="renderCheckout()"></div>
</form>
</div>
我还在 index.html 中包含以下行:
<script src="https://js.braintreegateway.com/js/braintree-2.23.0.min.js"></script>
总的来说,我对 Ionic 和 HTML5/JS 开发还很陌生,因此非常感谢任何帮助。
【问题讨论】: