conekta-react-native

0.3.5 • Public • Published
Conekta React Native banner

Conekta React Native npm version Swift Version

Conekta online payment processing platform on React Native

Currently iOS only

Installation

yarn add conekta-react-native # or npm i 

Link the module

react-native link conekta-react-native

iOS Notes

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

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

Licence

MIT

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i conekta-react-native

      Weekly Downloads

      1

      Version

      0.3.5

      License

      MIT

      Unpacked Size

      369 kB

      Total Files

      16

      Last publish

      Collaborators

      • cesargdm