Giter Site home page Giter Site logo

conekta-android's Introduction

README Cover Image

Conekta Android

You can use conekta-android for tokenize credit cards.

You have two methods to integrate conekta-android. Use artifacts or include our module.

Install Conekta Android Artifacts (AAR) 2.1

The artifact contains everything you need to start.

Instructions

This example uses mavenCentral to install the .aar (conektasdk) artefact.

repositories {
    mavenCentral()
}
...
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'io.conekta:conektasdk:2.1'
}

Now just Sync gradle

Import Conekta Android module 2.1

This is an example about how to create Android Apps importing conekta module.

Instructions

  1. Clone this project

  2. On your Android Studio go to: File -> New -> Import Module and find conektasdk folder on your file system.

  3. Go to File -> Project Structure..., this will open a window, then choose on Modules section your app, then click on Dependencies tab, then click on + button, and on Module dependency dialog, choose conektasdk.

Usage Conekta SDK

Just import all conekta classes from com.conekta namespace

  // Your code....
  import io.conekta.conektasdk.Conekta;
  import io.conekta.conektasdk.Card;
  import io.conekta.conektasdk.Token;
  import org.json.JSONObject;
  // Your code...
  
  private Activity activity = this;

  Conekta.setPublicKey("key_KJysdbf6PotS2ut2"); //Set public key
  Conekta.setApiVersion("0.3.0"); //Set api version (optional)
  Conekta.collectDevice(activity); //Collect device

  Card card = new Card("Josue Camara", "4242424242424242", "332", "11", "2017");
  Token token = new Token(activity);

  token.onCreateTokenListener( new Token.CreateToken(){
    @Override
    public void onCreateTokenReady(JSONObject data) {
      try {
        //TODO: Create charge
        Log.d("Token::::", data.getString("id"));
      } catch (Exception err) {
      //TODO: Handle error
        Log.d("Error: " + err.toString());
      }
    }
  });

  token.create(card);//Create token
  // Your code below....

Use conekta-android with Proguard

Just add

-keep class com.conekta.** { ; }

Example

alt tag

License

Developed in Mexico by Conekta in. Available with MIT License.


We are always hiring!

If you are a comfortable working with a range of backend languages (Java, Python, Ruby, PHP, etc) and frameworks, you have solid foundation in data structures, algorithms and software design with strong analytical and debugging skills. Send us your CV and GitHub to [email protected]

conekta-android's People

Contributors

picharras avatar mauriciomurga avatar leofischer avatar javiermurillo avatar richpeniche avatar

Watchers

René Soto Lira avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.