@cesargdm/conekta-react-native

0.2.6 • Public • Published

Conekta React Native banner

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

Package Sidebar

Install

npm i @cesargdm/conekta-react-native

Weekly Downloads

0

Version

0.2.6

License

MIT

Unpacked Size

350 kB

Total Files

12

Last publish

Collaborators

  • cesargdm