Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify Receipt Doesn't Work #679

Open
166341Aqeedat opened this issue Jun 30, 2022 · 1 comment
Open

Verify Receipt Doesn't Work #679

166341Aqeedat opened this issue Jun 30, 2022 · 1 comment

Comments

@166341Aqeedat
Copy link

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)")
            }
        }
    }
@babyking
Copy link

babyking commented Oct 1, 2022

same as me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants