Description
Describe the bug
This issue only comes in android in iOS working fine
LocalizedErrorMessage(code: FailureCode.Failed, localizedMessage: Card details not complete, message: Card details not complete, stripeErrorCode: null, declineCode: null, type: null)
To Reproduce
Steps to reproduce the behavior:
- Entering number 4242 4242 4242 4242 || 12/28 ||123 into the cardfield.
- Tapping the confirm button.
- Observe a failure with exception (including the part of the stack trace, belonging to this package) …
LocalizedErrorMessage(code: FailureCode.Failed, localizedMessage: Card details not complete, message: Card details not complete, stripeErrorCode: null, declineCode: null, type: null)
Expected behavior
A clear and concise description of what you expected to happen.
Smartphone / tablet
- Device: [e.g. pixel 8 pro]
- OS: [e.g. Android 15]
- flutter_stripe: ^11.3.0
- Flutter version 3.29.3
Additional context
SizedBox(
height: 55.r,
child: CardField(
style: context.proximaNovaFontBoldTextStyle.copyWith(),
decoration: const InputDecoration(
border: InputBorder.none,
// Remove all custom decoration
isDense: true,
contentPadding: EdgeInsets.zero,
),
onCardChanged: (card) {
ref.read(paymentProvider.notifier).updateCardDetails(card);
},
),
),
===
Future setStripePaymentIntent(PaymentDataModel data) async {
if (state.cardDetails == null || !state.cardDetails!.complete) {
Utils.showToast('Please enter complete card details');
_setListenerNone();
return;
}
state = state.copyWith(listener: const ProviderListener.loading());
if (ServiceConstants.isStripeStage) {
Stripe.publishableKey = Env.stripsProductionKey;
} else {
Stripe.publishableKey = Env.stripsStagingKey;
}
if (kDebugMode) {
print('${Stripe.publishableKey}');
}
final request = <String, dynamic>{
'name': nameController.text.trim(),
'email': emailController.text.trim().toLowerCase(),
'catId': data.squeez?.category?.catId,
'itemId': data.squeez?.category?.itemId,
};
final response = await ref.read(squeezHistoryServiceProvider).setupPaymentIntent(request: request);
if (!response.isSuccess) {
state = state.copyWith(listener: const ProviderListener.none());
return;
}
await Future.delayed(const Duration(milliseconds: 300));
try {
final setupIntent = await Stripe.instance.createPaymentMethod(
params: PaymentMethodParams.card(
paymentMethodData: PaymentMethodData(
billingDetails: BillingDetails(
name: nameController.text.trim(),
email: emailController.text.trim().toLowerCase(),
),
),
),
);
if (kDebugMode) {
print('${setupIntent}');
}
if (StringUtils.isNotNullOrEmpty(setupIntent.id)) {
await createSqueez(data, setupIntent.id, response.data?.customerId ?? '');
} else {
_setListenerNone();
throw Exception('Card verification failed');
}
} on StripeException catch (e) {
Utils.showToast(e.error.localizedMessage ?? 'StripeException');
_setListenerNone();
} on Exception catch (e) {
Utils.showToast(e.toString());
_setListenerNone();
}
}