0.2.6 • Published 6 years ago

@cesargdm/conekta-react-native v0.2.6

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Conekta React Native npm version

Currently iOS only

Pure JavaScript implementation under branch pure-javascript (wip)

Installation

yarn add conekta-react-native # or npm i

Link the module

react-native link conekta-react-native

Usage

With async/await:

const conekta = new Conekta('key_KJysdbf6PotS2ut2')

const card = conekta.createCard({
  number: '4242424242424242',
  name: 'Julian Ceballos',
  cvc: '123',
  expMonth: '10',
  expYear: '2018',
})

try {
  const data = await card.createToken()
  console.log('DATA', data)
} catch (error) {
  console.log('ERROR', error)
}

Or if you prefer promises:

const conekta = new Conekta('key_KJysdbf6PotS2ut2')

const card = conekta.createCard({
  number: '4242424242424242',
  name: 'Julian Ceballos',
  cvc: '123',
  expMonth: '10',
  expYear: '2018',
})

card
  .createToken()
  .then((data) => {
    console.log('DATA', data)
  })
  .catch((error) => {
    console.log('ERROR', error)
  })

TODO

  • Android version
  • Optimization
  • Testing

Please feel free to post a PR to help

Licence

MIT