1

I have installed square_in_app_payments in my flutter app but, whenever I enter the card number "41111-111..." and click the save details, the android app closes. This only happens after it is in the Play Store. During Debug and test it works perfectly. Only after on internal test track.

I am using: square_in_app_payments: ^1.4.1

Here are my settings:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.2, on macOS 11.2.2 20D80 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.61.0)
[✓] Connected device (2 available)

Here is my code:

void _squarePay() {
    InAppPayments.setSquareApplicationId(squareApplicationId);
    InAppPayments.startCardEntryFlow(
      onCardNonceRequestSuccess: _cardNonceRequestSuccess,
      onCardEntryCancel: _cardEntryCancel,
    );
  }


  void _cardNonceRequestSuccess(CardDetails result) {
    print('Testing nonce');

    InAppPayments.completeCardEntry(
      onCardEntryComplete: _cardEntryComplete,
    );

    setState(() {
      nonce = result.nonce;
    });

    //Add Nonce Pop Up
    print(result.nonce);
  }

  void _cardEntryComplete() {
    squareTwoButtonPopup(
      
      Text('Add New Card To Profile?'),
    );
  }

Any ideas would be appreciated

1 Answers1

0

Try to make a minimal code and see if it happens on release build, if it does use logs to find the issue or use this, if it does NOT happen on a minimal code then do the following:

Create a new project and copy all the dart code into it this should solve the issue.

here is a minimal code snippet

 onTap: () async {
                              await InAppPayments.startCardEntryFlow(
                                onCardNonceRequestSuccess: (d) {
                                  print('success');
                                },
                                onCardEntryCancel: () {
                                  print('cancelled');
                                },
                              );

user16930239
  • 6,319
  • 2
  • 9
  • 33