Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nuremx/conekta-react-native
React Native Conekta wrapper for iOS (Android missing)
https://github.com/nuremx/conekta-react-native
conekta ios payments react-native swift
Last synced: 2 months ago
JSON representation
React Native Conekta wrapper for iOS (Android missing)
- Host: GitHub
- URL: https://github.com/nuremx/conekta-react-native
- Owner: nuremx
- Created: 2018-08-18T21:18:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-27T16:34:32.000Z (almost 6 years ago)
- Last Synced: 2024-10-16T09:04:13.121Z (3 months ago)
- Topics: conekta, ios, payments, react-native, swift
- Language: Swift
- Homepage: https://conekta.com
- Size: 354 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Conekta React Native [![npm version](https://badge.fury.io/js/conekta-react-native.svg)](https://badge.fury.io/js/conekta-react-native) [![Swift Version](https://img.shields.io/badge/Swift-4.0.x-orange.svg)](https://swift.org)
> Conekta online payment processing platform on React Native
> **Currently iOS only**
## Installation
```bash
yarn add conekta-react-native # or npm i
```Link the module
```bash
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](https://facebook.github.io/react-native/docs/linking-libraries-ios).
**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](https://stackoverflow.com/questions/50096025/it-gives-errors-when-using-swift-static-library-with-objective-c-project)
## Usage
With async/await:
```javascript
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:
```javascript
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
- [ ] TestingPlease feel free to post a PR
## Licence
MIT