SwiftyStoreKit icon indicating copy to clipboard operation
SwiftyStoreKit copied to clipboard

Verify Receipt Doesn't Work

Open 166341Aqeedat opened this issue 2 years ago • 1 comments

I have implemented SwiftyStoreKit.verifyReceipt and SwiftyStoreKit.verifySubscription methods. While debugging, debugger never goes inside switch statement although result contain "success" when debugged in InAppReceiptVerificator class verifyReceipt() method.

Here is the function :

    func SubscriptionVerify(productID: String){
        SwiftyStoreKit.verifyReceipt(using: appleValidator!) { result in
            switch result {
            case .success(let receipt):
                let productId = 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):
                    print("\(productId) is valid until \(expiryDate)\n\(items)\n")
                    
                case .expired(let expiryDate, let items):
                    print("\(productId) is expired since \(expiryDate)\n\(items)\n")
                case .notPurchased:
                    print("The user has never purchased \(productId)")
                }

            case .error(let error):
                print("Receipt verification failed: \(error)")
            }
        }
    }

166341Aqeedat avatar Jun 30 '22 08:06 166341Aqeedat

same as me

babyking avatar Oct 01 '22 15:10 babyking