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

Card details not Complete on Andriod #2005

Open
phawadshah opened this issue Dec 7, 2024 · 1 comment
Open

Card details not Complete on Andriod #2005

phawadshah opened this issue Dec 7, 2024 · 1 comment
Labels
needs triage Needs triage

Comments

@phawadshah
Copy link

phawadshah commented Dec 7, 2024

Describe the bug
Creating Payment Method from Card on Andriod throws "Card details not complete". The below code works perfect on ios. I get the card details from the customer using card form field and then create payment method and then confirm payment method, it throws exception "incomplete card details" on the andriod.

To Reproduce
Steps to reproduce the behavior:

  1. Use CardFormField and enter any testing card number
  2. Create Payment Method from the card
  3. StripeException(error: LocalizedErrorMessage(code: FailureCode.Failed, localizedMessage: Card details not complete, message: Card details not complete, stripeErrorCode: null, declineCode: null, type: null))

// ------ CARD FORM FIELD.

    CardFormField(
      controller: controller,
      onCardChanged:(){},
      autofocus: true,
      onFocus: (cardFocus) {
        log(cardFocus.toString());
      },
      enablePostalCode: true,
      style: CardFormStyle(
        backgroundColor: AppColors.NEUTRAL_100,
        textColor: AppColors.NEUTRAL_950,
        cursorColor: AppColors.PRIMARY_BASE,
        borderColor: Colors.transparent,
        placeholderColor: AppColors.NEUTRAL_800,
        borderWidth: 2,
      ),
    ),
    CustomButton(
      width: Get.width,
      height: 50.h,
      buttonStyle: CustomButtonStyle.ACTIVE,
      title: "Apply",
      onPressed: () async {
        if (controller.details.complete == true) {
          CardFieldInputDetails details = controller.details;

          PaymentCardModel card = PaymentCardModel(
            last4: details.last4.toString(),
            expMonth: details.expiryMonth,
            expYear: details.expiryYear,
            cardType: CardTypeExtension.fromString(details.brand),
          );

          widget.onApplyCardTap?.call(card);
        } else {
          SnackbarUtil.showError(
              title: "Required",
              message: "Please enter valid card details");
        }
      },
    ),
  ],
);

// -------- CREATING PAYMENT METHOD.

try {
  PaymentMethod paymentMethod = await Stripe.instance.createPaymentMethod(
    params: PaymentMethodParams.card(
      paymentMethodData: PaymentMethodData(
        billingDetails: billingDetails,
      ),
    ),
  );

  return PaymentProcessResponse(exception: null, object: paymentMethod);
} on StripeException catch (e) {
    throw e;
} catch (e) {
  throw e;
}

}
Expected behavior
Should return Payment Method.

Smartphone / tablet

  • Pixel 7 pro, Emulator
  • OS: Andriod 15
  • Package version: 11.3.0
  • Flutter version [e.g. 2.0.0.]

Additional context
It's perfectly working on ios but on the andriod it throws that the card details are incomplete, and exception is thrown from creatPaymentMethod catch fun.

@ignatz @spendres @cornwe19 @asaarnak

@phawadshah phawadshah added the needs triage Needs triage label Dec 7, 2024
@Nikunj-Flutter
Copy link

@phawadshah any update on this issue , i am facing same error while doing this.

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

No branches or pull requests

2 participants