Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google pay button not visble without any error #270

Open
osama300 opened this issue Aug 1, 2024 · 4 comments
Open

google pay button not visble without any error #270

osama300 opened this issue Aug 1, 2024 · 4 comments

Comments

@osama300
Copy link

osama300 commented Aug 1, 2024

i use string json config
here print error but not print any thing

onError: (e){
print('this error $e');
},

@augustineonu
Copy link

I have same issue.
i don't get an error from the method or plugin, what I get is the childOnError widget which is from the package.
ALso, I want to know if it possible to integrate for Countries like Nigeria. I successfully see the button on ios simulator, but not on ios real device.
Below is a code that doesn't display for android.

FutureBuilder(
future: _googlePayConfigFuture,
builder: (context, snapshot) {
return snapshot.hasData
? GooglePayButton(

                      paymentConfiguration: snapshot.data!,
                      paymentItems: _paymentItems,
                      type: GooglePayButtonType.buy,
                      margin: const EdgeInsets.only(top: 15.0),
                      onPaymentResult: (result) {
                        print("result:: ${result}");
                      },
                      width: phoneWidth,
                      childOnError: const Text("Google Pay not supported"),
                      loadingIndicator: const Center(
                        child: CircularProgressIndicator(),
                      ),
                    )
                  : snapshot.hasError
                      ? textWidget(context,
                          title: "Erro: ${snapshot.error.toString()}")
                      : textWidget(context, title: "unknown error");
            }),

@TetrixGauss
Copy link

Make sure you have a card in your google wallet! This has happened to me and when i added a card in the google wallet the button appeared. The same issues can be fixed with the same way in the ios platform.

@JlUgia
Copy link
Member

JlUgia commented Oct 6, 2024

Hello, the error object contains information about the issue. What do you see there?

@justoke
Copy link

justoke commented Oct 30, 2024

I had this issue and it was ultimately down to ensuring that the state of widget holding the button was correctly set. I had user actions that were determining when the pay button would show, but button would not show and this caused it always to attempt to access the childOnError property. I used this function every time state was changed and it resolved the issue:

updateAppState() async {
    int value = 0;
    await Future.doWhile(() async {
      value++;
      await Future.delayed(const Duration(milliseconds: 700));
      if (value == 5) {
        if (mounted) {
          setState(() {});
        }
        return false;
      }
      if (mounted) {
        setState(() {});
      }
      return true;
    });
  }

And then wherever state was changed I made a call to that function:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants