Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/suraphanL/SwiftInAppPurchase
https://github.com/suraphanL/SwiftInAppPurchase
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/suraphanL/SwiftInAppPurchase
- Owner: suraphanL
- License: other
- Created: 2015-12-13T14:53:08.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-29T14:55:14.000Z (over 8 years ago)
- Last Synced: 2024-07-31T17:06:21.251Z (3 months ago)
- Language: Swift
- Size: 40 KB
- Stars: 21
- Watchers: 3
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - SwiftInAppPurchase - Simply code In App Purchases with this Swift Framework. (Payments / Other Parsing)
- awesome-ios-star - SwiftInAppPurchase - Simply code In App Purchases with this Swift Framework. (Payments / Other Parsing)
README
# SwiftInAppPurchase
Simply code In App Purchases with this Swift Framework[![CI Status](http://img.shields.io/travis/Rawd/SwiftInAppPurchase.svg?style=flat)](https://travis-ci.org/Rawd/SwiftInAppPurchase)
[![Version](https://img.shields.io/cocoapods/v/SwiftInAppPurchase.svg?style=flat)](http://cocoapods.org/pods/SwiftInAppPurchase)
[![License](https://img.shields.io/cocoapods/l/SwiftInAppPurchase.svg?style=flat)](http://cocoapods.org/pods/SwiftInAppPurchase)
[![Platform](https://img.shields.io/cocoapods/p/SwiftInAppPurchase.svg?style=flat)](http://cocoapods.org/pods/SwiftInAppPurchase)## 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](http://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod "SwiftInAppPurchase"
```## Author
Rawd, [email protected]
## 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) -> () inswitch 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
}
}