Reminder: By Aug 31, 2025, all new apps and updates to existing apps must use Billing Library version 7 or newer. If you need more time to update your app, you can request an extension until Nov 1, 2025. Learn about Play Billing Library version deprecation.
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Die Play Billing Library gibt eine BillingResult-Antwort zurück, damit du
das Ergebnis einer ausgelösten Aktion wissen. Weitere Informationen finden Sie unter BillingResult-Antwortcodes verarbeiten. Bevor Sie
Wenn Sie Ihre App in der Produktionsumgebung bereitstellen, können Sie die verschiedenen
Antwortflüsse mithilfe des Response Simulators erstellen.
Antwortsimulator
Wenn du deine App in die Play Billing Library einbindest, kann es schwierig sein,
können Sie alle BillingResponseCode-Abläufe testen,
die Kommunikation zwischen dem Play Store und dem
Play-Backend steuern.
Mit der Funktion „Response Simulator“ (Antwortsimulator) in der Play Billing Lab App können Sie Folgendes tun:
Fehlercodeantworten für die Play Billing Library konfigurieren, um verschiedene komplexe
Fehlerszenarien durch.
Testen von Abrechnungsüberschreibungen für die Play Billing Library aktivieren
Damit die Kommunikation zwischen dem Response Simulator und Ihrer App funktioniert, müssen Sie die Tests für die Abrechnungsüberschreibungen für die Play Billing Library in Ihrer App aktivieren. Fügen Sie dazu der AndroidManifest.xml-Datei Ihrer App die folgenden Metadaten-Tags hinzu.
Wenn Sie Ihre Anwendung in der Produktionsumgebung bereitstellen, sollten Sie entweder
Verwenden Sie eine separate AndroidManifest.xml-Datei, die diese Zeichen nicht enthält
oder entfernen Sie diese Tags aus dem
AndroidManifest.xml-Datei.
Play Billing Library-Fehler simulieren
Wenn Sie Play Billing Library-Fehler simulieren möchten, konfigurieren Sie zuerst die Antwortcodes in der Play Billing Lab App und testen Sie dann Ihre App.
Antwortcode konfigurieren
Melden Sie sich in der Play Billing Lab App mit einem Lizenztestkonto für Ihre App an.
Daraufhin wird das Play Billing Lab Dashboard mit folgenden Informationen angezeigt:
die Karte Response Simulator (Antwortsimulator)
Abbildung 1: Karte „Antwortsimulator“.
Klicken Sie auf der Karte „Antwortsimulator“ auf Verwalten.
Daraufhin wird der Bildschirm Antwortsimulator angezeigt.
Wenn du dazu aufgefordert wirst, lasse Benachrichtigungen vom Play Billing Lab zu, um den Verbindungsstatus deiner App zu sehen.
Aktivieren Sie den Schalter Play Billing Library-Antworten simulieren, falls das nicht der Fall ist.
bereits aktiviert.
Abbildung 2: Simulieren Sie den Wechsel der Play Billing Library-Antworten.
Wählen Sie einen Antwortcode für die Play Billing Library APIs aus, die Sie testen möchten.
Ihre Auswahl wird automatisch gespeichert und der Response Simulator kann die ausgewählten Antwortcodes an Ihre App senden.
Fehlerbehandlung der App testen
Öffnen Sie die App.
Wenn Sie Benachrichtigungen von Play Billing Lab zugelassen haben, wird in der Statusleiste Ihres Geräts das Benachrichtigungssymbol von Play Billing Lab angezeigt. Dies bedeutet, dass eine Verbindung zum Response Simulator hergestellt wurde.
Abbildung 3: Das Play Billing Lab-Symbol zeigt an, dass die Verbindung erfolgreich hergestellt wurde.
Lösen Sie die Play Billing Library API-Methode aus, die Sie testen möchten. Wenn Sie beispielsweise die launchBillingFlow testen möchten, starten Sie einen In-App-Kaufvorgang.
Alle Inhalte und Codebeispiele auf dieser Seite unterliegen den Lizenzen wie im Abschnitt Inhaltslizenz beschrieben. Java und OpenJDK sind Marken oder eingetragene Marken von Oracle und/oder seinen Tochtergesellschaften.
Zuletzt aktualisiert: 2025-07-27 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-07-27 (UTC)."],[],[],null,["# Test BillingResult response codes\n\nThe Play Billing Library returns a [`BillingResult`](/reference/com/android/billingclient/api/BillingResult) response to let you\nknow the outcome of an action that was triggered. For more\ninformation, see [handling `BillingResult` response codes](/google/play/billing/errors). Before you\ndeploy your app to the production environment, you can test your app's various\nresponse flows by using the Response Simulator.\n\nResponse Simulator\n------------------\n\nWhen you integrate your app with the Play Billing Library, it can be difficult\nto test all of the [`BillingResponseCode`](/reference/com/android/billingclient/api/BillingClient.BillingResponseCode) flows, because you don't have much\ncontrol over the communication between the Play Store and Play's backend.\nThe Response Simulator feature in the [Play Billing Lab](https://play.google.com/store/apps/details?id=com.google.android.apps.play.billingtestcompanion) app lets you\nconfigure error code responses for the Play Billing Library to test various complex\nerror scenarios.\n\n### Enable billing overrides testing for the Play Billing Library\n\n| **Note:** Before testing, ensure that your app is using [Play Billing Library](/google/play/billing/integrate#dependency) version 7.1.1 or later.\n\nTo enable communication between the Response Simulator and your app,\nyou must enable billing overrides testing for the Play Billing Library\nfrom within your app. To do this, add the following metadata tags to your app's\n`AndroidManifest.xml` file. \n\n```scdoc\n\u003cmanifest ... \u003e\n \u003capplication ... \u003e\n ...\n \u003cmeta-data\n android:name=\"com.google.android.play.largest_release_audience.NONPRODUCTION\"\n android:value=\"\" /\u003e\n \u003cmeta-data\n android:name=\"com.google.android.play.billingclient.enableBillingOverridesTesting\"\n android:value=\"true\" /\u003e\n \u003c/application\u003e\n\u003c/manifest\u003e\n```\n| **Note:** Even though adding only the `enableBillingOverridesTesting` tag and setting it to `true` is sufficient to enable billing overrides testing for your app, it's recommended that you also add the `NONPRODUCTION` tag. The `NONPRODUCTION` tag prevents accidental deployment of your app to the production environment with billing overrides testing enabled.\n\nWhen you deploy your app to the production environment, you should either\nuse a separate `AndroidManifest.xml` file that doesn't include these\nmetadata tags or ensure that you've removed these tags from the\n`AndroidManifest.xml` file.\n\n### Simulate Play Billing Library errors\n\nTo simulate Play Billing Library errors, first, configure the response codes\nin the [Play Billing Lab](https://play.google.com/store/apps/details?id=com.google.android.apps.play.billingtestcompanion) app, and then test your app.\n\n#### Configure a response code\n\n1. In the Play Billing Lab app, sign in with a [license tester](/google/play/billing/test#license-testers) account for your app.\n This displays the Play Billing Lab **Dashboard** including\n the **Response Simulator** card.\n\n **Figure 1.** Response Simulator card.\n2. Click **Manage** on the Response Simulator card.\n This shows the **Response Simulator** screen.\n\n3. When prompted, allow notifications from Play Billing Lab to see the connection status of your app.\n\n4. Enable the **Simulate Play Billing Library responses** switch, if it isn't\n already enabled.\n\n **Figure 2.** Simulate Play Billing Library responses switch.\n5. Select a response code for the Play Billing Library APIs that you want\n to test.\n Your selections are automatically saved, and the Response Simulator\n is ready to send the selected response codes to your app.\n\n#### Test your app's error handling\n\n| **Note:** When testing using the Response Simulator, ensure that you first open Play Billing Lab, and then open your app. Opening your app before opening Play Billing Lab may result in issues connecting to the Response Simulator.\n\n1. Open your app.\n\n - If you have allowed notifications from Play Billing Lab, you will see the Play Billing Lab notification icon in your device's status bar which indicates a successful connection to the Response Simulator.\n\n **Figure 3.** Play Billing Lab icon indicating successful connection.\n2. Trigger the Play Billing Library API method you want to test. For example,\n if you want to test the `launchBillingFlow`, initiate an in-app purchase\n flow."]]