Testing Android IAP/In-App Purchase Subscriptions

匿名 (未验证) 提交于 2019-12-03 02:06:01

问题:

I am implementing several Android applications to be launched on Google Play and they all have subscriptions using the Google IAP auto-renewing subscription product type.

To test the app I have done the following:

  • Uploaded a draft binary to Google Play but not published it.

  • Created and published the Subscription product in the developer console.

  • Added my Google account to the list of test accounts in the developer console

  • Exported my APK from eclipse (with the same package name and version name/code as the one uploaded to Google Play)

  • Installed this exported APK on my test device which is logged in with the test account.

I am now able to successfully test my purchase and every thing works. However, as far as I can see, this purchase is real and the subscription is actually valid for an entire month.

Is there no way to do any kind of "sandbox" testing or at least a way to prematurely cancel this subscription?

How can I test the scenario where my subscription has expired without having to wait a month?!

Any help is much appreciated!

回答1:

Not for subscriptions. The new (v3) in-app billing API has been released, but it currently does not support subscriptions. When it does, it might bring an easier way to test (seems unlikely though). You just have to cancel subscriptions/purchases in the merchant console when you are done testing.



回答2:

Google has finally added a way to test subscriptions. Their documentation now says:

Test purchases, which let your selected license-test users purchase your in-app products without any resulting charges to the user. Test purchases can be used in alpha/beta releases or in published apps.

Note: Test subscription purchases recur daily, regardless of the product's subscription period.

http://developer.android.com/google/play/billing/billing_testing.html

But I don’t know when Google made the update to this documentation.



回答3:

As they has said, you can do it following de goolge documentation:

http://developer.android.com/google/play/billing/billing_testing.html

The only thing you need is to add an acount for test:

Luego crea cuentas de prueba de licencias para los usuarios autorizados. En la Developer Console, ve a Settings > Account details y luego, en la sección License Testing, agrega las direcciones en el campo Gmail accounts with testing access. Para obtener más información, consulta Configuración para compras de prueba. Blockquote



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!