bizz84 / SwiftyStoreKit

Lightweight In App Purchases Swift framework for iOS 8.0+, tvOS 9.0+ and macOS 10.10+ ⛺
MIT License
6.54k stars 794 forks source link

Purchase not completing in app review. #361

Open rahulvashisht42 opened 6 years ago

rahulvashisht42 commented 6 years ago

Platform

In app purchase type

Environment

Hello,

I am using this function to purchase product of in app purchase:

func purchase(_ purchase: RegisteredPurchase) {

    SwiftyStoreKit.purchaseProduct(bundleId + "." + purchase.rawValue, atomically: false) { result in

   if case .success(let product) = result {

            print(product.transaction.transactionIdentifier!)

            if product.needsFinishTransaction {
                SwiftyStoreKit.finishTransaction(product.transaction)
            }

        }else{
            if let alert = self.alertForPurchaseResult(result) {
            self.showAlert(alert)
            }
        }
    }
}

It's working fine when I was testing with test user. But in app review it got rejected with reason:

We found that your in-app purchase products exhibited one or more bugs when reviewed on iPad running iOS 11.3 on Wi-Fi connected to an IPv6 network.

Specifically, we are unable to complete the in app purchase due to an error.

Next Steps

When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code “Sandbox receipt used in production,” you should validate against the test environment instead.

Please help me how can i change the environment during purchase. Because I will validate the receipt with both the environment once purchase will be successfull but their purchase is failling then how i will validate it with both environment. It gives error of paymentinvalid Please tell me the solution of it.

pengxianhe commented 6 years ago

The Same, App Store Refused

botsbuzz commented 6 years ago

App Store team review rejected my app for the same reason. Any idea to solve the issue? I don't validate any receipt. My code is like this below: SwiftyStoreKit.purchaseProduct("com.musevisions.SwiftyStoreKit.Purchase1", quantity: 1, atomically: true) { 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") } } }

rebeloper commented 6 years ago

Most probably it is not a code issue. Make sure that everything else is set up properly in iTunes Connect. Check out my video on this: https://youtu.be/upTO0g_Qjhs

eftalersoy commented 6 years ago

Same problem here It seems validation process throwing .unknown type of error. This code was working fine 2 months ago I am trying to purchase autorenew subscription in sandbox enviroment.

svalagorn commented 6 years ago

Same here. Looks like it's a sandbox server issue: https://forums.developer.apple.com/thread/96389

snake302 commented 6 years ago

Same trouble, any news?

vkill commented 6 years ago

+1

rafaelapaula commented 6 years ago

Someone find solution?

bizz84 commented 6 years ago

Apologies for the late reply everyone.

This is likely a duplicate of https://github.com/bizz84/SwiftyStoreKit/issues/81, and has been discussed to some length there.

AdieOlami commented 5 years ago

hi please I have been unable to get this project to work kind view my issue and contribute to it please thanks. https://github.com/bizz84/SwiftyStoreKit/issues/412