根据要求在Braintree-Web API中位置1处的JSON中出现意外令牌o

时间:2019-06-18 12:20:35

标签: angular7 braintree

我已经将Braintree集成到我的angular 7应用程序中。但是我有一个错误。到目前为止,我一直在搜索,但无法找到解决方案。

错误::

zone.js:199 Uncaught SyntaxError: Unexpected token o in JSON at position 1
    at JSON.parse (<anonymous>)
    at wk (fb.js:1)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:498)
    at invokeTask (zone.js:1744)
    at globalZoneAwareCallback

index.html ::

<script src="https://js.braintreegateway.com/web/3.46.0/js/client.min.js"></script>

App.component.ts ::

declare var braintree:any;

export class AppComponent implements OnInit {

    ngOnInit(){
        braintree.client.create({
            authorization: 'token'
            }, function (createErr, clientInstance) {
            clientInstance.request({
                endpoint: 'payment_methods/credit_cards',
                method: 'POST',
                data: {
                    creditCard: {
                        number: '4111111111111111',
                        cvv: '123',
                        expirationDate: '12/23'
                    }
                }
                }, function (requestErr, response) {
                    console.log(response)
            });
        });
    }
}

参考链接:: braintree-web

请告诉我如何解决此问题。

0 个答案:

没有答案