Flutter, React Native, Unity - Handle errors

Efficiently manage errors in Flutter, React Native, and Unity development using Adapty SDK's AdaptyError, ensuring comprehensive troubleshooting capabilities

Every error is returned by the SDK is AdaptyErrorCode. Here is an example:

    try {
      final result = await adapty.makePurchase(product: product);
    } on AdaptyError catch (adaptyError) {
      if (adaptyError.code == AdaptyErrorCode.paymentCancelled) {
        // Cancelled
      }
    } catch (e) {
    }
try {
  const params: MakePurchaseParamsInput = {};
  await adapty.makePurchase(product, params);
} catch (error) {
  if (
    error instanceof AdaptyError &&
    error.adaptyCode === getErrorCode(ErrorCode['2'])
  ) {
    // payment cancelled
  }
}
Adapty.MakePurchase(product, (profile, error) => {
  if (error != null && error.Code == Adapty.ErrorCode.PaymentCancelled) {
      // payment cancelled
  }
});

 System StoreKit codes

ErrorCodeDescription
unknown0This error indicates that an unknown or unexpected error occurred.
clientInvalid1This error code indicates that the client is not allowed to perform the attempted action.
paymentCancelled2This error code indicates that the user canceled a payment request.
No action is required, but in terms of the business logic, you can offer a discount to your user or remind them later.
paymentInvalid3This error indicates that one of the payment parameters was not recognized by the store.
paymentNotAllowed4This error code indicates that the user is not allowed to authorize payments. Possible reasons:
- Payments are not supported in the user's country.
- The user is a minor.
storeProductNotAvailable5This error code indicates that the requested product is absent from the App Store. Make sure the product is available for the used country.
cloudServicePermissionDenied6This error code indicates that the user has not allowed access to Cloud service information.
cloudServiceNetworkConnectionFailed7This error code indicates that the device could not connect to the network.
cloudServiceRevoked8This error code indicates that the user has revoked permission to use this cloud service.
privacyAcknowledgementRequired9This error code indicates that the user has not yet acknowledged the store privacy policy.
unauthorizedRequestData10This error code indicates that the request is built incorrectly.
invalidOfferIdentifier11The offer identifier is not valid. Possible reasons:
- You have not set up an offer with that identifier in the App Store.
- You have revoked the offer.
- You misprinted the offer ID.
invalidSignature12This error code indicates that the signature in a payment discount is not valid. Make sure you've filled out the In-app purchase Key ID field and uploaded the In-App Purchase Private Key file. Refer to the Configure App Store integration topic for details.
missingOfferParams13This error indicates issues with Adapty integration or with offers.
Refer to the Configure App Store integration and to Offers for details on how to set them up.
invalidOfferPrice14This error code indicates that the price you specified in the store is no longer valid. Offers must always represent a discounted price.

Custom Android codes

ErrorCodeDescription
adaptyNotInitialized20You need to properly configure Adapty SDK by Adapty.activate method. Learn how to do it for Flutter, for React Native, and for Unity.
productNotFound22This error indicates that the product requested for purchase is not available in the store.
invalidJson23The paywall JSON is not valid. Fix it in the Adapty Dashboard. Refer to the Customize paywall with remote config topic for details on how to fix it.
currentSubscriptionToUpdateNotFoundInHistory24The original subscription that needs to be renewed is not found.
pendingPurchase25This error indicates that the purchase state is pending rather than purchased. Refer to the Handling pending transactions page in the Android Developer docs for details.
billingServiceTimeout97This error indicates that the request has reached the maximum timeout before Google Play can respond. This could be caused, for example, by a delay in the execution of the action requested by the Play Billing Library call.
featureNotSupported98The requested feature is not supported by the Play Store on the current device.
billingServiceDisconnected99This fatal error indicates that the client app’s connection to the Google Play Store service via the BillingClient has been severed.
billingServiceUnavailable102This transient error indicates the Google Play Billing service is currently unavailable. In most cases, this means there is a network connection issue anywhere between the client device and Google Play Billing services.
billingUnavailable103This error indicates that a user billing error occurred during the purchase process. Examples of when this can occur include:

1. The Play Store app on the user's device is out of date.
2. The user is in an unsupported country.
3. The user is an enterprise user, and their enterprise admin has disabled users from making purchases.
4. Google Play is unable to charge the user’s payment method. For example, the user's credit card might have expired.
developerError105This is a fatal error that indicates you're improperly using an API.
billingError106This is a fatal error that indicates an internal problem with Google Play itself.
itemAlreadyOwned107The consumable product has already been purchased.
itemNotOwned108This error indicates that the requested action on the item failed sin

Custom StoreKit codes

ErrorCodeDescription
noProductIDsFound1000This error indicates that none of the products in the paywall is available in the store.
If you are encountering this error, please follow the steps below to resolve it:

1. Check if all the products have been added to Adapty Dashboard.
2. Ensure that the Bundle ID of your app matches the one from the Apple Connect.
3. Verify that the product identifiers from the app stores match with the ones you have added to the Dashboard. Please note that the identifiers should not contain Bundle ID, unless it is already included in the store.
4. Confirm that the app paid status is active in your Apple tax settings. Ensure that your tax information is up-to-date and your certificates are valid.
5. Check if a bank account is attached to the app, so it can be eligible for monetization.
6. Check if the products are available in all regions.

Also, ensure that your products are in “Ready to Submit” state.
productRequestFailed1002Unable to fetch available products at the moment. Possible reason:
- No cache was yet created and no internet connection at the same time.
cantMakePayments1003In-App purchases are not allowed on this device.
noPurchasesToRestore1004This error indicates that Google Play did not find the purchase to restore.
cantReadReceipt1005There is no valid receipt available on the device. This can be an issue during sandbox testing.
No action is required, but in terms of the business logic, you can offer a discount to your user or remind them later.
productPurchaseFailed1006Product purchase failed.
refreshReceiptFailed1010This error indicates that the receipt was not received. Applicable to StoreKit 1 only.
receiveRestoredTransactionsFailed1011Purchase restoration failed.

Custom network codes

ErrorCodeDescription
notActivated2002You need to properly configure Adapty SDK by Adapty.activate method. Learn how to do it for Flutter , for React Native , and for Unity .
badRequest2003Bad request.
serverError2004Server error.
networkFailed2005The network request failed.
decodingFailed2006This error indicates that response decoding failed.
encodingFailed2009This error indicates that request encoding failed.
analyticsDisabled3000???We can't handle analytics events, since you've opted it out. Refer to the Analytics integration topic for details.
wrongParam3001This error indicates that some of your parameters are not correct: blank when it cannot be blank or wrong type, etc.
activateOnceError3005It is not possible to call .activate method more than once.
profileWasChanged3006The user profile was changed during the operation.
fetchTimeoutError3101This error means that the paywall could not be fetched within the set limit. To avoid this situation, set up local fallbacks.
operationInterrupted9000This operation was interrupted by the system.


What’s Next