Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
SwiftyStoreKit.purchaseProduct("プロダクトID", quantity: 1, atomically: true) { result in
switch result {
case .success(let purchase):
// print("Purchase Success: \(purchase.productId)")
// 購入後の処理はここに記述しよう。例えばUser Default などのフラグを変更するとか。
case .error(let error):
// switch error.code {
// case .unknown: print("Unknown error. Please contact support")
// case .clientInvalid: print("Not allowed to make the payment")
// case .paymentCancelled: break
// case .paymentInvalid: print("The purchase identifier was invalid")
// case .paymentNotAllowed: print("The device is not allowed to make the payment")
// case .storeProductNotAvailable: print("The product is not available in the current storefront")
// case .cloudServicePermissionDenied: print("Access to cloud service information is not allowed")
// case .cloudServiceNetworkConnectionFailed: print("Could not connect to the network")
// case .cloudServiceRevoked: print("User has revoked permission to use this cloud service")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.