/android-sdk

Primary LanguageJavaMIT LicenseMIT

EBANX SDK

Intro

The EBANX Android SDK was created to facilitate the creation of tokens, set the CVV created a token and tokens list already created by the SDK.

Other features need to be made from server to server using its integration key.

Features

Requirements

  • Android 4.0.3+

Integration

Download

Download the latest aar

Gradle

compile 'com.ebanx:sdk:1.0.0'

Maven

<dependency>
  <groupId>com.ebanx</groupId>
  <artifactId>sdk</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>

Configuration

How to get a Public Key

Public key and the integration of key are generated at the time of creation of the merchant account.

Click here for more details

Set Public Key

// Configuration for production environment
EBANX.configure(getApplicationContext(), "your public key");

// Configuration for development environment
EBANX.configure(getApplicationContext(), "your public key", true);

Usage

Create Token

The token operation is used to create a token for a given credit card to be used for recurrent payments.

// Create a creditcard
EBANXCreditCard card = new EBANXCreditCard("Fulano de tal", "4012888888881881", "12/2016", "321", EBANXCreditCardType.Visa);

EBANX.Token.create(card, EBANXCountry.BR, new EBANXTokenRequestComplete() {
    @Override
    public void Success(EBANXToken token) {
        // Object EBANXToken
    }

    @Override
    public void APIError(EBANXError error) {
        // Object EBANXError
        // possibles type values:
        // PublicKeyNotSet - Public key is not set in EBANX.configure()
        // InvalidPublicKey - Public key invalid (API response)
        // ParseError - Object not found
        // GenericError
    }

    @Override
    public void NetworkError(Exception e) {
        // Object error from NSURLSession case request fail
    }
});

Set CVV

The setCVV operation is used to temporary associate a CVV with an existing token. This CVV will be used by the next request made with the associated token and then discarded.

The setCVV operation is useful for one-click payments, where you already have the customer's credit card information and cannot send the CVV from your server.

// Set CVV from credicard token
EBANXToken token = new EBANXToken("123456......123456", "4111********1111");

EBANX.Token.setCVV(token, "123", new EBANXTokenRequestComplete() {
    @Override
    public void Success(EBANXToken token) {
        // Object EBANXToken
    }

    @Override
    public void APIError(EBANXError error) {
        // Object EBANXError
        // possibles type values:
        // PublicKeyNotSet - Public key is not set in EBANX.configure()
        // InvalidPublicKey - Public key invalid (API response)
        // ParseError - Object not found
        // GenericError
    }

    @Override
    public void NetworkError(Exception e) {
        // Object error from NSURLSession case request fail
    }
});

Get all tokens

// return List<EBANXToken>
List<EBANXToken> tokenList = EBANX.Token.getTokens();

Get token by masked creditcard number

// return EBANXToken
EBANXToken token = EBANX.Token.getToken("4111********1111");

Delete token

EBANToken currentToken = .......

EBANX.Token.deleteToken(token);

Delete all tokens

EBANX.Token.deleteAllTokens();

Credit

EBANX SDK is owned and maintained by the EBANX

Contact email mobile@ebanx.com

License

EBANX SDK is released under the MIT license. See LICENSE for details.