android in app billing purchase verification failed

后端 未结 4 1844
孤城傲影
孤城傲影 2020-12-13 07:18

i\' having trouble implementing in app billing in my android app. i\'m getting a purchase signature verification failed. In a first time i tough it was the base64 key but i

4条回答
  •  情书的邮戳
    2020-12-13 07:23

    You can use the test SKU's to do testing, as explained here. These are:

    • android.test.purchased
    • android.test.canceled
    • android.test.refunded
    • android.test.item_unavailable

    These purchases will be successful (at least the android.test.purchased) even in test and debug scenario's, without the need to cancel the purchase.

    In the verifyPurchase I changed return false to:

        Log.e(TAG, "Purchase verification failed: missing data.");
        if (BuildConfig.DEBUG) {
                return true;
        }
        return false;           
    

    but you should be aware to use this only in test scenario's.

    This will return true, if you have a debug build, and the signature data is missing. Since the BuildConfig.DEBUG will be false in a production build this should be OK. But better is to remove this code after everything is debugged.

提交回复
热议问题