Latest 0.1.0
Homepage https://github.com/snapcard/ios-merchant-sdk
License MIT
Platforms ios 8.0, requires ARC
Dependencies Alamofire, libPusher
Authors

SNAPCARD iOS Merchant SDK

[![CI Status](http://img.shields.io/travis/Daniel Thengvall/SnapCardMerchantSdk.svg?style=flat)](https://travis-ci.org/Daniel Thengvall/SnapCardMerchantSdk)
Version
License
Platform

Installation

SnapCardMerchantSdk is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SnapCardMerchantSdk"

Api

  • To implement the SNAPCARD merchant api you will need your merchant id, you can find it here: https://www.snapcard.io/account#!/api

  • Firstly you’ll need to implement the SCInvoiceCallbackProtocol in the view controller you wish to display the invoice prompt. Typically this is your root view controller.

    import SnapCardMerchantSdk
    
    class ViewController: UIViewController, SCInvoiceCallbackProtocol {
    
      ...
    
    }

    ViewController.swift:4

  • The invoice callback protocol requires five methods to be implemented the onSnapcardPaymentUpdated and onSnapcardPaymentCompleted methods return an SCInvoice object

    func onSnapcardPaymentCompleted(invoice: SCInvoice) {
        print("onPaymentComplete")
    }
    
    func onSnapcardPaymentError(error: NSError) {
        print(error)
    }
    
    func onSnapcardPaymentCancelled() {
        print("cancelled")
    }
    
    func onSnapcardPaymentUpdated(invoice: SCInvoice) {
        print("onUpdate")
    }
    
    func getSnapcardViewController() -> UIViewController {
        return self
    }

    ViewController:19

  • Finally you’ll need to initiate the invoice popup:

    @IBAction func onBuyButtonSelected(sender: AnyObject) {        
    
        SCInvoiceFactory.create("<merchant-id>", amount: 1.0, currency: "USD", shipping: 0.0, tax: 0.0, delegate: self)
    }

    ViewController.swift:14

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

SnapCardMerchantSdk

Third Party Libraries

License

SnapCardMerchantSdk is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SnapCardMerchantSdk",
    "version": "0.1.0",
    "summary": "An sdk",
    "description": "An sdk for snapcard",
    "homepage": "https://github.com/snapcard/ios-merchant-sdk",
    "license": "MIT",
    "authors": {
        "DTHENG": "[email protected]"
    },
    "source": {
        "git": "https://github.com/snapcard/ios-merchant-sdk.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "**/*.{swift}",
    "resources": "**/*.{png,jpeg,jpg,storyboard,xib}",
    "dependencies": {
        "Alamofire": [
            "3.1.2"
        ],
        "libPusher": [
            "1.6.1"
        ]
    }
}

Pin It on Pinterest

Share This