• 7

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I'm following this docs to implement google pay:


After running this function and purchage a product:

fun buy() {

    val skuList = listOf("vip_small")

    if (billingClient.isReady) {
        val params = SkuDetailsParams
        billingClient.querySkuDetailsAsync(params) { responseCode, skuDetailsList ->

            if (responseCode == BillingClient.BillingResponse.OK) {

                Log.d("lets", "querySkuDetailsAsync, responseCode: $responseCode")

                val flowParams = BillingFlowParams.newBuilder()
                        .setType(BillingClient.SkuType.INAPP) // SkuType.SUB for subscription

                val responseCodee = billingClient.launchBillingFlow(this, flowParams)

                Log.d("lets", "launchBillingFlow responseCode: $responseCodee")

            } else {
                Log.d("lets", "Can't querySkuDetailsAsync, responseCode: $responseCode")
    } else {
        Log.d("lets", "Billing Client not ready")

which works fine I want to know if the purchage has been made so I add this code from the cods:

override fun onPurchasesUpdated(@BillingResponse responseCode: Int, purchases: List<Purchase>?) {
    if (responseCode == BillingResponse.OK && purchases != null) {
        for (purchase in purchases) {
    } else if (responseCode == BillingResponse.USER_CANCELED) {
        // Handle an error caused by a user cancelling the purchase flow.
    } else {
        // Handle any other error codes.

But I get the error 'onPurchasesUpdated' overrides nothing

So I remove override and get this "error"

Function "onPurchasesUpdated" is never used

What the hell?? How to call this damn function after the purchage has been made?

I got the solution.

You need to make the activity/fragment use the PurchasesUpdatedListener like:

class VIP : AppCompatActivity(), PurchasesUpdatedListener {


Then override will work

  • 1
Reply Report