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

SwiftyStoreKit.verifyReceipt method is not working #692

Open
aalokhyperlink opened this issue Apr 27, 2023 · 3 comments
Open

SwiftyStoreKit.verifyReceipt method is not working #692

aalokhyperlink opened this issue Apr 27, 2023 · 3 comments

Comments

@aalokhyperlink
Copy link

Bug Report

Hello I am using SwiftyStoreKit.verifyReceipt method for verify receipt validation but its always return failure like user has not purchased this plan I am checking it after purchase product

I am using below code

let appleValidator = AppleReceiptValidator(service: .sandbox, sharedSecret: "xxxxxxxxxxx")

    SwiftyStoreKit.verifyReceipt(using: appleValidator) { result in
        switch result {
        case .success(let receipt):
            print(receipt)
            let productId = "user_subscription_purchase_id"
            // 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)")
        }
    }

Platform Information

  • OS: [e.g. iOS 13.4]
  • Purchase Type: [auto-renewable subscription]
  • Environment: [sandbox]
@Kaustubh06
Copy link

This is because
the latest information of this verifyReceipt API has been deprecated??
https://developer.apple.com/documentation/appstorereceipts/verifyreceipt?changes=latest_minor

@clubappqa
Copy link

any replacement for this method?

@codicil
Copy link

codicil commented Jun 8, 2024

I am running into same problem, after successful purchase recipes is not authenticated, any solution to this?

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

4 participants