Guides
GuidesLog In
Guides

Troubleshooting

This guide describes issues you may encounter while developing and testing in-app purchases in your app

Android

Troubleshooting

Common steps

In case you experience any issues with in-app purchases in your Android app, please check the following:

  • Make sure you have correctly set up Google Play Service Credentials .
  • View debug logs in Android Studio. To enable debug logs call: Apphud.enableDebugLogs() before SDK initialization.
  • If you have any issues with credentials, the error will also populate in the Android Studio console.
  • Make sure you have entered the correct Android Package Name in Apphud app settings.
  • If you don't use Apphud billing client, make sure Apphud.syncPurchases() is called after a successful purchase or restoration.

Still having issues? Pass us debug logs from your Android Studio, and we will help you.

iOS Troubleshooting

Payment cancelled but Apphud.hasActiveSubscription method still returns true

Please check your Apphud user's purchase history. Probably, you made purchases earlier for this user. Try testing with a fresh install.

Payment completed but it does not appear in Apphud / Apphud.hasActiveSubscription returns false

In case you experience any issues with in-app purchases in Apphud, please check the following steps:

  • Make sure you have entered correctly Shared Secret .
  • View debug logs in Xcode. To enable debug logs call: Apphud.enableDebugLogs() before SDK initialization. If you have any issues with in-app purchases, the error will populate in the console.
  • Make sure you have entered the correct iOS Bundle ID.

Errors during the purchase

When you make purchases using Apphud, in response you get ApphudPurchaseResult object. If the purchase failed, you get an error that may be of three classes:

  • SKError from StoreKit with SKErrorDomain codes. This is a system error when purchasing transactions. Apphud is not responsible for SKError domain codes, because they are returned directly from App Store.
  • NSError from HTTP Client with NSURLErrorDomain codes. This is a network/server issue when uploading receipts to Apphud.
  • Custom ApphudError without codes. For example, if couldn't sign a promo offer or couldn't get an App Store receipt. This is an SDK level error.

"Cannot connect to iTunes Store" / SKError.code = unknown

If you experience issues like "Cannot connect to iTunes Store" or your SKPaymentTransaction fails with SKError.code = unknown, it is a generic error message that App Store generates. This may be one of the:

  • Transaction is interrupted by the Ask to Buy feature
  • Transaction is interrupted due to Strong Customer Authentication
  • There was another problem with the user's Apple ID account.

Apphud SDK is unable to fix the issue and the developer is responsible to handle these types of errors. The best practice is to check the error code, and if it is SKError.code = paymentCancelled, then the payment was cancelled by the user, do nothing in this case. In other cases, you may want to display the error message to the user.

Another case of a high percentage of failed transactions is Strong Customer Authentication (SCA) for European Economic Area, which requires all payments to be verified. In this case, the current transaction goes to the failed state, and once payment is approved, a new transaction with the purchased state is created. Apphud SDK automatically handles interrupted purchases for this case as well, you have nothing to do about it.

Failed to get App Store Receipt

This error means that the App Store receipt is missing on the device even after a successful purchase. Apphud SDK automatically tries to recover the receipt with SKReceiptRefreshRequest , but if the receipt is still missing "Failed to get App Store Receipt" error will be thrown. Apphud SDK is unable to recover this issue due to an iOS / Sandbox bug. Unfortunately, this often happens to Apple Reviewers.

App was rejected due to purchase problems

If your app got rejected and worked fine in Xcode / TestFlight builds during the test, don't worry – your app probably works fine, but reviewers are having issues with their devices. They may experience the following issues:

  • Transaction failed with SKError.code = unknown
  • Transaction complete, but Failed to get App Store Receipt error is thrown in case App Store receipt is missing on the device even after purchase.
  • Transaction complete, but Sandbox server is down. In this case, Apphud SDK will throw an error.

The first thing you need to do is to determine, whether SKProducts were actually loaded in the reviewer's paywall screen. In most cases, the reviewer attaches a screenshot of their error/paywall screen.

If products did load correctly and prices were displayed, then it is probably a payment issue. The next thing is to try to find the reviewer's error in your product analytics, if available.

Workaround:

  • Just re-submit the same build and send the reviewer a message about the Sandbox issue.
  • Add a code workaround for Sandbox only by letting users go through the paywall screen if the transaction's state is purchased. Here is an example:
extension ApphudPurchaseResult {
    var success: Bool {
        subscription?.isActive() ?? false ||
            nonRenewingPurchase?.isActive() ?? false ||
            (Apphud.isSandbox() && transaction?.transactionState == .purchased)
    }
}

Apple reviewer provided tips regarding validating receipt in a sandbox environment

Sometimes, the reviewer provides a tip with the following message:

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.

This tip is useless since Apphud automatically handles sandbox and production environments.

App was rejected due to the use of ASIdentifierManager (IDFA)

Since Apphud SDK 2.1.0 ASIdentifierManager is no longer used as well as AdSupport framework:

pod update 'ApphudSDK'

StoreKit Products Not Available Error

See the answer below for Failed to load SKProducts from the App Store error.

"Failed to load SKProducts from the App Store" error

Failed to load SKProducts from the App Store, because product identifiers are invalid error means that Product IDs provided in Apphud Product Hub are invalid. Please check the following:

  • Check that the Product ID is correct and doesn't contain hidden spaces, tabs, etc.
  • You agreed to the latest Apple Developer Program License Agreement.
  • You completed all the financial agreements as described in the Agreements, Tax, and Banking.
  • You use the correct bundle ID and signing credentials.

For more information please read the following.

Attempted to decode store response error while fetching products

If you encounter the decoding error Failed to load SKProducts from the App Store, error with reason Attempted to decode store response **** , that probably means that you are running the app in iOS Simulator which doesn't support App Store features. Try running on a physical device instead.
On iOS Simulator you can test App Store features using Local StoreKit configuration file.

Products are not appearing in the Paywall screen

Keep in mind, that StoreKit products are not appearing immediately after the first app launch. The network request is made to App Store to fetch the products. And if your app displays a paywall screen immediately after launch, be ready to handle case, when products are fetched after the screen is shown.

Make sure your paywall screen is updated even if products received after paywall screen is shown.

You can be notified when paywalls are fully loaded using Apphud.fetchPlacements{} or Apphud.paywallsDidLoadCallback methods.

Once products are fetched, update your UI.

Purchases are ready for sale, but not available in the app

When your app update is approved with new in-app purchases, they may not be available for purchase for the first few hours after approval. This is an App Store cache issue and not related to Apphud SDK (or any other SDKs). In most cases your in-app purchases are ready immediately after approval, however, it may take up to 24 hours.

I made iOS Sandbox purchase, but it's not appearing in Apphud

Sometimes when you make purchases too often, Sandbox servers do not create any new transactions. Try to clear purchase history in Sandbox account settings in your iOS device.

If the problem still persists, ask your developer to view console logs in Xcode. There might be issues with wrong credentials (invalid shared secret, bundle id, or StoreKit2 credentials).