Problem with google play billing library

I’m having problem with google play billing library in cocos. It seems to be working fine a few weeks ago but now it stoped working. I’m using

protected void onCreate(Bundle savedInstanceState) {
        obj = this;
        mContext = this;
        billingClient = BillingClient.newBuilder(this)
                        (billingResult, list) -> {
                            System.out.println("This is not executed")
        //start the connection after initializing the billing client

It does not go to listner. I tried updating the label to still not working. It shows list as empty even thoough it should hav some values. Does anyone have any example code that I can check?

you have better go to google to ask the question

cocos creator 谷歌支付_cocos creator接google支付-CSDN博客 check this one

Have tried but couldn’t find any solution.

I am not familiar with the google play billing, you can ask the ask the ChatGPT for the answer.

1 Like

You should check the billingResult code, it will return the results and also a message if failing.
I do something like this:

if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && purchases != null) {
            if (DEBUG) {
                System.out.println("onPurchasesUpdated OK");
            for (Purchase purchase : purchases) {
        } else if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.USER_CANCELED) {
            if (DEBUG) {
                System.out.println("onPurchasesUpdated CANCELED");
            if (purchaseListener != null) {
        } else {
            if (DEBUG) {
                System.out.println("onPurchasesUpdated FAILED "+billingResult.getDebugMessage());
            if (purchaseListener != null) {

Do not take in cosideration “purchaseListener” I did create my own library to handle inapp and ads.

It is working fine now, there was a problem with product ID and Application ID