CocoaPods trunk is moving to be read-only. Read more on the blog, there are 7 months to go.

EBANX 1.1.0

EBANX 1.1.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2017
SwiftSwift Version 3.1
SPMSupports SPM

Maintained by Andre Cocuroci.



EBANX 1.1.0

  • By
  • EBANX

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+

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.