0

我尝试了很多次,以至于我在使用braintree-angular和braintree-web和angularjs fullstack时变得秃头,但是当我在checkout页面中时,我得到一个令牌错误并且没有显示任何付款选项......

product-checkout.html //ngcart 工作正常顺便说一句

<div class="container">
    <div class="row">
        <h1>Cart</h1>
        <ngcart-cart template-url="components/ngcart/cart.html"></ngcart-cart>
    </div>
    <div class="row">enter code here
        <h1>Choose a payment method</h1>
        <p class="help-block">{{ errors }}</p>
        <br>
        <div class="col-md-6">
            <form>
                <braintree-dropin options="paymentOptions">Loading...</braintree-dropin>

                    <input type="submit" value="Purchase" />
            </form>
        </div>
    </div>
    </div>

(我认为 Braintree-dropin 不再有效,因为它已被弃用)

每次我在结帐页面时都会收到错误

angular.js:14961 TypeError: $braintree.getClientToken(...).success is not a
function
    at Object.$braintree.setupDropin (braintree-factory.js:28)
    at controller (braintree-angular.js:24)
    at Object.invoke (angular.js:5117)
    at $controllerInit (angular.js:11139)
    at nodeLinkFn (angular.js:10002)
    at compositeLinkFn (angular.js:9311)
    at nodeLinkFn (angular.js:10065)
    at compositeLinkFn (angular.js:9311)
    at compositeLinkFn (angular.js:9314)
    at compositeLinkFn (angular.js:9314)
    at compositeLinkFn (angular.js:9314)
    at nodeLinkFn (angular.js:10065)
    at compositeLinkFn (angular.js:9311)
    at publicLinkFn (angular.js:9176)
    at Object.<anonymous> (angular-ui-router.js:4138)
    at angular.js:1393
    at invokeLinkFn (angular.js:10682)
    at nodeLinkFn (angular.js:10071)
    at compositeLinkFn (angular.js:9311)
    at publicLinkFn (angular.js:9176)
    at lazyCompilation (angular.js:9567)
    at updateView (angular-ui-router.js:4056)
    at angular-ui-router.js:4005
    at Scope.$broadcast (angular.js:19123)
    at angular-ui-router.js:3369
    at processQueue (angular.js:17330)
    at angular.js:17378
    at Scope.$digest (angular.js:18515)
    at Scope.$apply (angular.js:18903)
    at angular.js:20829
    at completeOutstandingRequest (angular.js:6439)
    at angular.js:6718 "<div ui-view="" class="ng-scope">"
(anonymous) @ angular.js:14961
**api/braintree/client_token:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)**
angular.js:14961 Possibly unhandled rejection: {"data":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>**TypeError: _braintree2.default.findById is not a function<br> &nbsp; &nbsp;at show (D:/Projects/meanstore/server/api/braintree/braintree.controller.js:70:20)**<br> &nbsp; &nbsp;at Layer.handle [as handle_request] (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\layer.js:95:5)<br> &nbsp; &nbsp;at next (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\route.js:137:13)<br> &nbsp; &nbsp;at Route.dispatch (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\route.js:112:3)<br> &nbsp; &nbsp;at Layer.handle [as handle_request] (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\layer.js:95:5)<br> &nbsp; &nbsp;at D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:281:22<br> &nbsp; &nbsp;at param (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:354:14)<br> &nbsp; &nbsp;at param (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:365:14)<br> &nbsp; &nbsp;at Function.process_params (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:410:3)<br> &nbsp; &nbsp;at next (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:275:10)<br> &nbsp; &nbsp;at Function.handle (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:174:3)<br> &nbsp; &nbsp;at router (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:47:12)<br> &nbsp; &nbsp;at Layer.handle [as handle_request] (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\layer.js:95:5)<br> &nbsp; &nbsp;at trim_prefix (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:317:13)<br> &nbsp; &nbsp;at D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:284:7<br> &nbsp; &nbsp;at Function.process_params (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:335:12)<br> &nbsp; &nbsp;at next (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:275:10)<br> &nbsp; &nbsp;at Layer.handle [as handle_request] (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\layer.js:91:12)<br> &nbsp; &nbsp;at trim_prefix (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:317:13)<br> &nbsp; &nbsp;at D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:284:7<br> &nbsp; &nbsp;at Function.process_params (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:335:12)<br> &nbsp; &nbsp;at next (D:\\Projects\\meanstore\\node_modules\\express\\lib\\router\\index.js:275:10)</pre>\n</body>\n</html>\n","status":500,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"/api/braintree/client_token",
"headers":{"Accept":"application/json, text/plain, */*","X-XSRF-TOKEN":"t2sFfL5kWBa2Jo4GXP9OqmR2Ox9WJVtbxIH2w="}},"statusText":"Internal Server Error","xhrStatus":"complete"}

我后来从braintree-angular存储库中发现它不再维护......所以请如果有人可以建议我一个我可以快速使用的替代方案,因为我浪费了太多时间谢谢。

4

0 回答 0