BillingClient.BillingResponseCode

@Retention(value = java.lang.annotation.RetentionPolicy.SOURCE)
public annotation BillingClient.BillingResponseCode


Possible response codes.

Summary

Constants

static final int

A user billing error occurred during processing.

static final int

Error resulting from incorrect usage of the API.

static final int
ERROR = 6

Fatal error during the API action.

static final int

The requested feature is not supported by the Play Store on the current device.

static final int

The purchase failed because the item is already owned.

static final int

Requested action on the item failed since it is not owned by the user.

static final int

The requested product is not available for purchase.

static final int

A network error occurred during the operation.

static final int
OK = 0

Success.

static final int

The app is not connected to the Play Store service via the Google Play Billing Library.

static final int

This field is deprecated.

See SERVICE_UNAVAILABLE which will be used instead of this code.

static final int

The service is currently unavailable.

static final int

Transaction was canceled by the user.

Constants

BILLING_UNAVAILABLE

public static final int BILLING_UNAVAILABLE = 3

A user billing error occurred during processing.

Examples where this error may occur:

  • The Play Store app on the user's device is out of date.
  • The user is in an unsupported country.
  • The user is an enterprise user and their enterprise admin has disabled users from making purchases.
  • Google Play is unable to charge the user’s payment method.

Letting the user retry may succeed if the condition causing the error has changed (e.g. An enterprise user's admin has allowed purchases for the organization).

DEVELOPER_ERROR

public static final int DEVELOPER_ERROR = 5

Error resulting from incorrect usage of the API.

Examples where this error may occur:

  • Invalid arguments such as providing an empty product list where required.
  • Misconfiguration of the app such as not signing the app or not having the necessary permissions in the manifest.

ERROR

public static final int ERROR = 6

Fatal error during the API action.

This is an internal Google Play error that may be transient or due to an unexpected condition during processing. You can automatically retry (e.g. with exponential back off) for this case and contact Google Play if issues persist. Be mindful of how long you retry if the retry is happening during a user interaction.

FEATURE_NOT_SUPPORTED

public static final int FEATURE_NOT_SUPPORTED = -2

The requested feature is not supported by the Play Store on the current device.

If your app would like to check if a feature is supported before trying to use the feature your app can call isFeatureSupported to check if a feature is supported. For a list of feature types that can be supported, see FeatureType.

For example: Before calling showInAppMessages API, you can call isFeatureSupported with the FeatureType#IN_APP_MESSAGING featureType to check if it is supported.

ITEM_ALREADY_OWNED

public static final int ITEM_ALREADY_OWNED = 7

The purchase failed because the item is already owned.

Make sure your app is up-to-date with recent purchases using guidance in the Fetching purchases section in the integration guide. If this error occurs despite making the check for recent purchases, then it may be due to stale purchase information that was cached on the device by Play. When you receive this error, the cache should get updated. After this, your purchases should be reconciled, and you can process them as outlined in the processing purchases section in the integration guide.

ITEM_NOT_OWNED

public static final int ITEM_NOT_OWNED = 8

Requested action on the item failed since it is not owned by the user.

Make sure your app is up-to-date with recent purchases using guidance in the Fetching purchases section in the integration guide. If this error occurs despite making the check for recent purchases, then it may be due to stale purchase information cached on the device by Play. When you receive this error, the cache should get updated. After this, your purchases should be reconciled, and you can process the purchases accordingly. For example, if you are trying to consume an item and if the updated purchase information says it is already consumed, you can ignore the error now.

ITEM_UNAVAILABLE

public static final int ITEM_UNAVAILABLE = 4

The requested product is not available for purchase.

Please ensure the product is available in the user’s country. If you recently changed the country availability and are still receiving this error then it may be because of a propagation delay.

NETWORK_ERROR

public static final int NETWORK_ERROR = 12

A network error occurred during the operation.

This error indicates that there was a problem with the network connection between the device and Play systems. This could potentially also be due to the user not having an active network connection.

OK

public static final int OK = 0

Success.

SERVICE_DISCONNECTED

public static final int SERVICE_DISCONNECTED = -1

The app is not connected to the Play Store service via the Google Play Billing Library.

Examples where this error may occur:

  • The Play Store could have been updated in the background while your app was still running and the library lost connection.
  • startConnection was never called or has not completed yet.
Since this state is transient, your app should automatically retry (e.g. with exponential back off) to recover from this error. Be mindful of how long you retry if the retry is happening during a user interaction. The retry should lead to a call to startConnection right after or in some time after you received this code.

SERVICE_TIMEOUT

public static final int SERVICE_TIMEOUT = -3

The request has reached the maximum timeout before Google Play responds.

Since this state is transient, your app should automatically retry (e.g. with exponential back off) to recover from this error. Be mindful of how long you retry if the retry is happening during a user interaction.

SERVICE_UNAVAILABLE

public static final int SERVICE_UNAVAILABLE = 2

The service is currently unavailable.

Since this state is transient, your app should automatically retry (e.g. with exponential back off) to recover from this error. Be mindful of how long you retry if the retry is happening during a user interaction.

USER_CANCELED

public static final int USER_CANCELED = 1

Transaction was canceled by the user.