ioan-ghisoi-cko / just-a-test-1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CheckoutSdkIos - Beta

Beta - Do not use before speaking to integration@checkout.com

Build Status CocoaPods Compatible Carthage Compatible Platform codecov codebeat badge license

Requirements

  • iOS 10.0+
  • Xcode 9.0+
  • Swift 4.1+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1+ is required to build CheckoutSdkIos 1.0+.

To integrate CheckoutSdkIos into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'CheckoutSdkIos', :git => 'https://github.com/floriel-fedry-cko/just-a-test.git'
end

Then, run the following command:

$ pod install

Carthage

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

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate CheckoutSdkIos into your Xcode project using Carthage, specify it in your Cartfile:

github "floriel-fedry-cko/just-a-test" ~> 0.2

Run carthage update to build the framework and drag the built CheckoutSdkIos into your Xcode project.

Demo

You can find intructions on how to run the demo here.

Usage

Create the API Client CheckoutAPIClient:

// replace "pk_test_6ff46046-30af-41d9-bf58-929022d2cd14" by your own public key
let checkoutAPIClient = CheckoutAPIClient(publicKey: "pk_test_6ff46046-30af-41d9-bf58-929022d2cd14",
                                          environment: .sandbox)

Create the CardUtils instance:

let cardUtils = CardUtils()

Create the card token request CardTokenRequest:

// create the phone number
let phoneNumber = CkoPhoneNumber(countryCode:number:)
// create the address
let address = CkoAddress(name:addressLine1:addressLine2:city:state:postcode:country:phone:)
// create the card token request
let cardTokenRequest = CkoCardTokenRequest(number:expiryMonth:expiryYear:cvv:name:billingAddress:)

Create a card token

let checkoutAPIClient = CheckoutAPIClient(publicKey: "pk_......", environment: .live)
checkoutAPIClient.createCardToken(card: cardTokenRequest, successHandler: { cardTokenResponse in
    // success
}, errorHandler { error in
    // error
})

License

CheckoutSdkIos is released under the MIT license. See LICENSE for details.

About

License:MIT License


Languages

Language:Swift 99.0%Language:Ruby 0.8%Language:Objective-C 0.2%Language:Shell 0.0%