zo0r / react-native-conekta

React Native Conekta SDK for iOS and Android
https://www.conekta.io
MIT License
32 stars 22 forks source link

Getting error - undefined is not an object (evaluating 'RNConekta.createToken') #5

Closed sagarmusale8 closed 7 years ago

sagarmusale8 commented 7 years ago

I am learner in React-Native and Conekta. Please help me.

My code is:

import Conekta from 'react-native-conekta'

initializeConekta = () => {
    var conektaApi = new Conekta()

    conektaApi.setPublicKey(CONEKTA_KEY)
    conektaApi.createToken({
      cardNumber: this.state.cardNumber,
      name: this.state.nameOnTheCard,
      cvc: this.state.cvv,
      expMonth: this.state.expMonth,
      expYear: this.state.expYear,
    }, function(data){
      console.log( 'DATA:' + data ); // data.id to get the Token ID
    }, function(err){
      console.log( 'Error:' + err );
    })
  }

@zo0r I am not sure what is wrong here? Could you please check and let me know what I miss here?

valentin7 commented 6 years ago

@sagarmusale8 were you able to fix this issue? how did you work around it?

sagarmusale8 commented 6 years ago

@valentin7 Yes, it was error in my implementation.

valentin7 commented 6 years ago

@sagarmusale8 I'm getting this same error — any idea on what it was for you and what the correct implementation was? Thanks again

sagarmusale8 commented 6 years ago

@valentin7 Don't know exactly what was the issue. But I was passing the wrong params.

sagarmusale8 commented 6 years ago

@valentin7 Yes, I was able to run it. But I don't remember now.