kraffslol / react-native-braintree-xplat

Cross-platform Braintree module for React Native
MIT License
81 stars 121 forks source link

Does not return any error and response? #121

Open harleenarora opened 4 years ago

harleenarora commented 4 years ago

Hi, I am integrate this package for get the card token based on my braintree tokenization key. But I have not got the any error and response. I have used latest react-native version.

Code:

import React, { PureComponent } from 'react';
import { Button } from 'react-native';
import BTClient from 'react-native-braintree-xplat';

class paymentMethod extends PureComponent {
    componentDidMount() {
        let token = 'braintree_tokenization_key';
        BTClient.setup(token);
    }

    getCardToken(){
        const card = {
            number: '4111111111111111',
            expirationDate: '10/2023',
            cvv: '123',
        }
        BTClient.getCardNonce(card).then(function (nonce) {
            console.log(nonce, 'nonce');
        }).catch(function (err) {
            console.log(err, 'err');
        });
    }

    render(){
        return (
            <Button onPress={()=>getCardToken()} > Card Token </Button>
        )
    }
}
export default paymentMethod;

Please tell me how to integrate this.