Unexpected token o in JSON at position 1 in braintree-web API on request

Viewed 132

I have integrate the braintree in my angular 7 application. But I have got the one error. I have search so far but can't get the solution.

Error::

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)
            });
        });
    }
}

Reference link:: braintree-web

Please tell me, how to solve this issue.

0 Answers
Related