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.ReceiptStatus.malformedOrMissingData #643

Open
jbarros35 opened this issue Jul 2, 2021 · 6 comments
Open

SwiftyStoreKit.ReceiptStatus.malformedOrMissingData #643

jbarros35 opened this issue Jul 2, 2021 · 6 comments

Comments

@jbarros35
Copy link

jbarros35 commented Jul 2, 2021

Question

Please explain your question in detail here.

I can't undestand whats happening. I'm on sandbox, I can't validate the receipt of a renewable subscription.

▿ 1 element
▿ 0 : 2 elements
- key : "status"
- value : 21002


SwiftyStoreKit.purchaseProduct(productId, completion: { result in
            switch result {
                case .success(let purchase):
                    print("Purchase Success: \(purchase.productId)")
                case .error(let error):
                    switch error.code {
                    case .unknown: print("Unknown error. Please contact support")
                    case .clientInvalid: print("Not allowed to make the payment")
                    case .paymentCancelled: break
                    case .paymentInvalid: print("The purchase identifier was invalid")
                    case .paymentNotAllowed: print("The device is not allowed to make the payment")
                    case .storeProductNotAvailable: print("The product is not available in the current storefront")
                    case .cloudServicePermissionDenied: print("Access to cloud service information is not allowed")
                    case .cloudServiceNetworkConnectionFailed: print("Could not connect to the network")
                    case .cloudServiceRevoked: print("User has revoked permission to use this cloud service")
                    default: print((error as NSError).localizedDescription)
                    }
                }
        })
        
        let appleValidator = AppleReceiptValidator(service: .sandbox, sharedSecret: "mysecret")
        SwiftyStoreKit.verifyReceipt(using: appleValidator) { result in
            switch result {
            case .success(let receipt):
                // Verify the purchase of Consumable or NonConsumable
                let purchaseResult = SwiftyStoreKit.verifySubscription(
                    ofType: .autoRenewable,
                                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)")
            }
        }
@jbarros35
Copy link
Author

This is the result of fetch receipt

MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwGggCSABIIBczGCAW8wDwIBAAIBAQQHDAVYY29kZTALAgEBAgEBBAMCAQAwHgIBAgIBAQQWDBRjb20uY2hlZmZ3YWxsZXRzLm5mdDALAgEDAgEBBAMMATQwEAIBBAIBAQQIdW5ePAgAAAAwHAIBBQIBAQQUORLMMfxIq2RXneA+4a+u+jD2NAswCgIBCAIBAQQCFgAwHgIBDAIBAQQWFhQyMDIxLTA3LTAyVDE3OjA0OjA5WjCBpQIBEQIBAQSBnDGBmTAMAgIGpQIBAQQDAgEBMCsCAgamAgEBBCIMIGNvbS5jaGVmZndhbGxldHMubmZ0LmNvbGxlY3Rpb25zMAwCAganAgEBBAMMATQwHwICBqgCAQEEFhYUMjAyMS0wNy0wMlQxNDozOTo1MFowHwICBqwCAQEEFhYUMjAyMi0wMS0wMlQxNDozOTo1MFowDAICBrcCAQEEAwIBATAeAgEVAgEBBBYWFDQwMDEtMDEtMDFUMDA6MDA6MDBaAAAAAAAAoIIDeDCCA3QwggJcoAMCAQICAQEwDQYJKoZIhvcNAQELBQAwXzERMA8GA1UEAwwIU3RvcmVLaXQxETAPBgNVBAoMCFN0b3JlS2l0MREwDwYDVQQLDAhTdG9yZUtpdDELMAkGA1UEBhMCVVMxFzAVBgkqhkiG9w0BCQEWCFN0b3JlS2l0MB4XDTIwMDQwMTE3NTIzNVoXDTQwMDMyNzE3NTIzNVowXzERMA8GA1UEAwwIU3RvcmVLaXQxETAPBgNVBAoMCFN0b3JlS2l0MREwDwYDVQQLDAhTdG9yZUtpdDELMAkGA1UEBhMCVVMxFzAVBgkqhkiG9w0BCQEWCFN0b3JlS2l0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA23+QPCxzD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3pgZD0+K5bkJhMeE69Ux3jbheSUBvFumhhi4t0WKcIJZooJjazWg5H1h/cgGtymVWxFwvKGh2jWOdsGAbfxJokoNarKmEnPqFrKHEifIPK4vXbYVjNZm/pWo9IJ4WXoiymg/mtqW71OAf4/+swQWMA4sgC+kR6BsQpVBpji+tH1Lq1Wi7QV4uIy+mVFQ7P6L1h86lHsiP+uil1EaL/c3fIkr9y58cCPFF97fMw0LDRwMrUYR4E4AAAAAAAA=

I'm trying to directly post this to apple, doesnt works at all

@peterng014
Copy link

I got the same issue here? anybody has idea please?

@ronnie-codes
Copy link

Go to your Xcode Scheme, select Run and then Options and change StoreKit Configuration to None. This was the fix for me anyway. This storekit configuration is a new local testing feature as of Xcode 12.

@MostafaAZ1994
Copy link

Anyone solve this issue, Please??

@thanksloving
Copy link

I got the same issue.

1 similar comment
@boyXiong
Copy link

I got the same issue.

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

6 participants