SwiftyStoreKit icon indicating copy to clipboard operation
SwiftyStoreKit copied to clipboard

(SOLVED) Verify receipt failed: networkError(error: Error Domain=SKErrorDomain Code=0 "(null)")

Open KatkayApps opened this issue 6 years ago • 4 comments

Platform

  • [ ] iOS
  • [X] macOS
  • [ ] tvOS

In app purchase type

  • [ ] Consumable
  • [ ] Non-consumable
  • [X] Auto-Renewable Subscription
  • [ ] Non-Renewing Subscription

Environment

  • [X] Sandbox
  • [ ] Production

Version

0.15.0

Related issues

ℹ Please replace this with references to similar issues (either open or already closed).

Report

Issue summary

Verify receipt failed: networkError(error: Error Domain=SKErrorDomain Code=0 "(null)") Receipt verification failed: networkError(error: Error Domain=SKErrorDomain Code=0 "(null)")

What did you expect to happen

Unable to retrieve the app's receipt. Receipt should be retrieved.

What happened instead

Faioled with error

Verify receipt failed: networkError(error: Error Domain=SKErrorDomain Code=0 "(null)") Receipt verification failed: networkError(error: Error Domain=SKErrorDomain Code=0 "(null)")

Unable to retrieve the receipt.

I am testing this app for months. All this time I am using SwiftyStoreKit and I have been able to retrieve and verify the receipt trillions of times all these months.

Today, January 4, about 10 AM GMT, the problems start. No more receipt retrieval.

KatkayApps avatar Jan 04 '20 16:01 KatkayApps

Hi, I experience this about once a day with users buying subscription. I can't figure it out either. Hundreds of others have purchased subscriptions just fine. Any suggestion how to code around this?

It's hitting the "case .error" block:

let appleValidator = AppleReceiptValidator(service: .production, sharedSecret: x)
                SwiftyStoreKit.verifyReceipt(using: appleValidator) { result in
                switch result {
                case .success(let receipt):
                    let productId = product.productId
                    // Verify the purchase of a Subscription
                    let purchaseResult = SwiftyStoreKit.verifySubscription(
                        ofType: .autoRenewable, // or .nonRenewing (see below)
                        productId: productId,
                        inReceipt: receipt)

                    switch purchaseResult {
                    case .purchased(let expiryDate, let items):
                        self.updatePurch(action: "POST:SUCCESS:\(product.productId):\(expiryDate)")
                        print("Settings>> \(productId) is valid until \(expiryDate)\n\(items)\n")
                         UserDefaults.standard.set(expiryDate, forKey: "sub_end_dttm")
                    case .expired(let expiryDate, let items):
                        self.updatePurch(action: "POST:Expired:\(product.productId)")
                        print("Settings>>  \(productId) is expired since \(expiryDate)\n\(items)\n")
                    case .notPurchased:
                        self.updatePurch(action: "POST:User not purchased:\(product.productId)")
                        print("Settings>>  The user has never purchased \(productId)")
                    }

                   case .error(let error):
                      self.updatePurch(action: "POST:ERROR:\(product.productId):\(error)")
                      print("Settings>> Receipt verification failed: \(error)")
                   }

theofficejackpot avatar Jan 07 '20 02:01 theofficejackpot

I am having this issue too. But I am having it on iOS (iPhone 8+ with iOS 13.3)

richardlm001 avatar Jan 08 '20 01:01 richardlm001

Same error for me with MacOS, Non-Consumable, sandbox & production have the same issue.

Fingerlab avatar Jan 14 '20 14:01 Fingerlab

I had this problem before on iOS but this this time the problem was on macOS.

I have discovered how to solve this:

  1. on macOS: create another user on the same computer and test it from there. It will work.
  2. on iOS device: backup your device and reset it to factory defaults.

What is sad is that this problem will affect zillions of users out there and they will not know how to solve this and we lose sales.

KatkayApps avatar Jan 14 '20 15:01 KatkayApps