Latest 1.1.0
Homepage https://github.com/ebanx/ios-sdk
License MIT
Platforms ios 8.0
Authors

EBANX SDK

Intro

The EBANX iOS 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

  • Swift 3
  • iOS 8.0+
  • Xcode 8.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. To install EBANX with CocoaPods:

  • Make sure CocoaPods is installed.
  • Update your Podfile to include the following:

    use_frameworks!
    pod 'EBANX'
  • Run pod install.
  • Use the .xcworkspace file generated by CocoaPods to work on your project!

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To install EBANX with Carthage:

  • Install Carthage via Homebrew

    $ brew update
    $ brew install carthage
  • Add github "ebanx/ios-sdk" to your Cartfile.
  • Run carthage update to build the framework.
  • Drag the build EBANX.framework into your Xcode project.

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

// import EBANX module in AppDelegate
import EBANX

// Configure public key SDK in application:didFinishLaunchingWithOptions:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Configuration for production environment
    EBANX.configure(publicKey: "your public key")

    // Configuration for development environment
    EBANX.configure(publicKey: "your public key", testMode: true)
    return true
}

Usage

Create Token

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

//import module
import EBANX

// Create a creditcard
let card = EBANXCreditCard(name: "Fulano de tal", number: "4111111111111111", dueDate: "12/2015", cvv: "123", type: .visa)

EBANX.Token.create(card: card, country: .br) { (result: EBANXTokenResult) in
    switch result {
    case .success(let token):
        // Object EBANXToken
    case .apiError(let apiError):
        // enum EBANXAPIErrors
        // possibles values:
        // publicKeyNotSet - Public key is not set in EBANX.configure()
        // invalidPublicKey - Public key invalid (API response)
        // parseError - Object not found
        // responseError - Object EBANXError
    case .networkError(let error):
        // 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.

//import module
import EBANX

// Set CVV from credicard token
EBANX.Token.setCVV(token: EBANXToken(token: "123456......123456", cardNumberMasked: "4111********1111"), cvv: "123") { (result: EBANXTokenResult) in 
    switch result {
    case .success(let token):
        // Object EBANXToken
    case .apiError(let apiError):
        // enum EBANXAPIErrors
        // possibles values:
        // PublicKeyNotSet - Public key is not set in EBANX.configure()
        // InvalidPublicKey - Public key invalid (API response)
        // ParseError - Object not found
        // ResponseError - Object EBANXError
    case .networkError(let error):
        // Object error from NSURLSession case request fail
    }
}

Get all tokens

// return Array<EBANXToken>
let tokens = EBANX.Token.getTokens()

Get token by masked creditcard number

// return EBANXToken?
let currentToken = EBANX.Token.getToken(cardNumberMasked: "4111********1111")

Delete token

let currentToken = .......

EBANX.Token.deleteToken(currentToken)

Delete all tokens

EBANX.Token.deleteAllTokens()

Credit

EBANX SDK is owned and maintained by the EBANX

Contact email [email protected]

License

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

Latest podspec

{
    "name": "EBANX",
    "version": "1.1.0",
    "summary": "iOS SDK for EBANX merchants",
    "homepage": "https://github.com/ebanx/ios-sdk",
    "license": {
        "type": "MIT",
        "file": "License"
    },
    "authors": {
        "EBANX": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/ebanx/ios-sdk.git",
        "tag": "1.1.0"
    },
    "source_files": "Source/**/*.{swift}",
    "pushed_with_swift_version": "3.1"
}

Pin It on Pinterest

Share This