Conekta online payment processing platform on React Native
Currently iOS only
yarn add conekta-react-native # or npm i
Link the module
react-native link conekta-react-native
Check that the Libraries group in Xcode have RNConekta
and the project settings include libRNConekta
in Linked Frameworks and Libraries. See Manual Linking.
Important. Since this module uses Swift, and RN projects are based in Obj-C, add an empty Swift file inside your project (no bridging header required), this will remove linked Xcode error. See related Stack Overflow Post
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);
});
- Android version
- Optimization
- Testing
Please feel free to post a PR
MIT