CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Sep 2017 |
SwiftSwift Version | 3.1 |
SPMSupports SPM | ✗ |
Maintained by Andre Cocuroci.
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.
Public key and the integration of key are generated at the time of creation of the merchant account.
// 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
}
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
}
}
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
}
}
// return Array<EBANXToken>
let tokens = EBANX.Token.getTokens()
// return EBANXToken?
let currentToken = EBANX.Token.getToken(cardNumberMasked: "4111********1111")
let currentToken = .......
EBANX.Token.deleteToken(currentToken)
EBANX.Token.deleteAllTokens()
EBANX SDK is owned and maintained by the EBANX
Contact email mobile@ebanx.com
EBANX SDK is released under the MIT license. See LICENSE for details.