Skip to content

Latest commit

 

History

History
64 lines (42 loc) · 1.46 KB

README.md

File metadata and controls

64 lines (42 loc) · 1.46 KB

Nativescript Conekta Sdk

Works on ios and android

Installation

Install with following command:

tns plugin add nativescript-conekta-sdk
// or
npm i nativescript-conekta-sdk

So while cloning from the repo

NativeScript demo android

NativeScript demo ios

Usage

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

License

Apache License Version 2.0, January 2004