0.2.6 • Published 6 years ago
@cesargdm/conekta-react-native v0.2.6
Conekta React Native
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
0.2.6
6 years ago