Latest 2.0.2
Homepage https://github.com/omise/omise-ios-swift
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

Omise-iOS-Swift is a Swift 2.0 library for managing token with Omise API.

By using the token produced by this library, you will be able to securely process credit card without letting sensitive information pass through your server. This token can also be used to create customer card data which will allow re-using of card data for the next payment without entering it again.

All data are transmitted via HTTPS to our PCI-DSS certified server.

Setup

Please copy all files in {repo root}/Omise-iOS/Omise-iOS/OmiseLib into your project.

Installation

Omise-iOS-Swift is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'Omise-iOS-Swift', '~> 2.0'

Primary classes

Card

A class representing a card information.

OmiseTokenRequest

A class encapsulating parameters for requesting token. You will have to set card information as a parameter for this class.

OmiseToken

A class representing token. This class is what will be passed to the delegate if the request is successful.

Omise

A class for requesting token. See also sample code below.

Test app

By opening Omise-iOS_Test.xcodeproj and building it on Xcode, the sample application will launch and create a charge token to test.

Request a token

AccessOmiseViewController.swift


override func viewDidLoad() {
    super.viewDidLoad()

    //set parameters
    let tokenRequest = OmiseTokenRequest()
    tokenRequest.publicKey = "pkey_test_4y7dh41kuvvawbhslxw" //required
    tokenRequest.card!.name = "JOHN DOE" //required
    tokenRequest.card!.city = "Bangkok" // optional
    tokenRequest.card!.postalCode = "10320" //optional
    tokenRequest.card!.number = "4242424242424242" //required
    tokenRequest.card!.expirationMonth = "11" //required
    tokenRequest.card!.expirationYear = "2016" //required
    tokenRequest.card!.securityCode = "123" //required

    //request
    let omise = Omise()
    omise.delegate = self
    omise.requestToken(tokenRequest)
}

// MARK: - OmiseTokenDelegate
extension AccessOmiseViewController: OmiseRequestDelegate {

    func omiseOnFailed(error: NSError?) {
        //handle error
    }

    func omiseOnSucceededToken(token: OmiseToken?) {
        //handle success
        if let token = token {
            //your code here
        }
    }
}

Latest podspec

{
    "name": "Omise-iOS-Swift",
    "version": "2.0.2",
    "summary": "Swift 2.0 client library for the Omise API",
    "description": "Omise-iOS-Swift is a library for managing payment authorization tokens andnstored credit card details with the Omise API.",
    "homepage": "https://github.com/omise/omise-ios-swift",
    "social_media_url": "https://twitter.com/omise",
    "authors": {
        "Omise": "[email protected]"
    },
    "license": "MIT",
    "source": {
        "git": "https://github.com/omise/omise-ios-swift.git",
        "tag": "v2.0.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Omise-iOS_SDK/Omise-iOS_SDK/SDK/*.swift",
    "frameworks": [
        "UIKit"
    ]
}

Pin It on Pinterest

Share This