Works on ios and android
Install with following command:
tns plugin add nativescript-conekta-sdk
// or
npm i nativescript-conekta-sdk
So while cloning from the repo
TypeScript
import { TNSConekta } from 'nativescript-conekta-sdk'
private conekta: TNSConekta;
this.conekta = new TNSConekta()
this.conekta.setPublicKey('your_key')
this.conekta.createToken(params) // Promise, params is required, (name, number, cvc, exp_month, exp_year)
JavaScript
const TNSConekta = require('nativescript-conekta-sdk').TNSConekta;
const conekta = new TNSConekta()
conekta.setPublicKey('your_key')
conekta.setLanguage('en') // only in android
conekta.createToken(params) // Promise, params is required, (name, number, cvc, exp_month, exp_year)
Handle errors
JavaScript
conekta.createToken(params).then(success => {
// your success function
}).catch(error => {
alert(error.message_to_purchaser)
}) // Promise, params is required, (name, number, cvc, exp_month, exp_year)
Wants card validation
Use this plugin Credit Card Validator
Apache License Version 2.0, January 2004