Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example Initial Commit Dec 13, 2015
Pod Initial Commit Dec 13, 2015
.gitignore Initial commit Dec 13, 2015
.travis.yml Initial commit Dec 13, 2015
LICENSE Initial Commit Dec 13, 2015
README.md Created description Feb 9, 2016
SwiftInAppPurchase.podspec Initial Commit Dec 13, 2015
_Pods.xcodeproj Initial commit Dec 13, 2015

README.md

SwiftInAppPurchase

Simply code In App Purchases with this Swift Framework

CI Status Version License Platform

Usage

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

Requirements

Installation

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

pod "SwiftInAppPurchase"

Author

Rawd, suraphan.d@gmail.com

License

SwiftInAppPurchase is available under the Apache 2.0 license. See the LICENSE file for more info.

##Production Mode SwiftInAppPurchase.sharedInstance.setProductionMode(false)

##Request Products var productIden = Set() productIden.insert("com.irawd.test.30d")

let iap = SwiftInAppPurchase.sharedInstance

iap.requestProducts(productIden) { (products, invalidIdentifiers, error) -> () in

}

##Purchase let iap = SwiftInAppPurchase.sharedInstance iap.addPayment("com.irawd.test.30d", userIdentifier: nil) { (result) -> () in

    switch result{
    case .Purchased(let productId,let transaction,let paymentQueue):

        paymentQueue.finishTransaction(transaction)
    case .Failed(let error):
        print(error)
    default:
        break
    }            
}

##RefreshReceipt let iap = SwiftInAppPurchase.sharedInstance iap.refreshReceipt { (error) -> () in print(error) } ##VerifyReceipt let iap = SwiftInAppPurchase.sharedInstance iap.verifyReceipt(nil) { (receipt, error) -> () in print(receipt) print(error) } ##Restore let iap = SwiftInAppPurchase.sharedInstance iap.restoreTransaction(nil) { (result) -> () in switch result{ case .Restored(let productId,let transaction,let paymentQueue) :

        paymentQueue.finishTransaction(transaction)
    case .Failed(let error):
        print(error)

    default:
    break
    }
}       

##CheckIncompleteTransaction let iap = SwiftInAppPurchase.sharedInstance iap.checkIncompleteTransaction { (result) -> () in switch result{ case .Purchased(let productId,let transaction,let paymentQueue): paymentQueue.finishTransaction(transaction) case .Restored(let productId,let transaction,let paymentQueue) :

        paymentQueue.finishTransaction(transaction)
    default:
        break
    }
}
You can’t perform that action at this time.