SwiftyStoreKit icon indicating copy to clipboard operation
SwiftyStoreKit copied to clipboard

SwiftyStoreKit.verifyReceipt method is not working

Open aalokhyperlink opened this issue 1 year ago • 3 comments

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]

aalokhyperlink avatar Apr 27 '23 09:04 aalokhyperlink

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

Kaustubh06 avatar Jun 30 '23 12:06 Kaustubh06

any replacement for this method?

clubappqa avatar Mar 12 '24 11:03 clubappqa