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 completed when i do confirmSetupIntent with intent id or do confirm payment with client secrete #506

Closed
axiftaj opened this issue Dec 31, 2021 · 1 comment
Assignees
Labels
needs triage Needs triage

Comments

@axiftaj
Copy link

axiftaj commented Dec 31, 2021

When I make payment from flutter and generate a client secret via node.js as backend and then retrieve that client secret via API it always throws an exception.

This process works fine when i create process on the app side and pay via payment sheet.

Exception:
Unhandled Exception: StripeException(error: LocalizedErrorMessage(code: FailureCode.Failed, localizedMessage: Card details not complete, message: Card details not complete, stripeErrorCode: null, declineCode: null, type: null))

Steps i followed:
I have recently implemented stripe payment integration in my flutter app with node.js as backend. Process i followed to make the payment.

  1. I created a customer in stripe via api using node.js, my customer is created successfully and can be seen in the dashboard.
  2. Then i tried to add the card for that customer that i have created, those cards got linked to the customer, this can be verified in the dashboard.
  3. Now i created the payment intent with my stripe id, payment method, card id and price. I can now recieved payment intent and client secrete.
  4. Then i confirm the intent but always throw exception card detail not complete
  5. When i do confirm payment method it always through always throws an exception card detail not found.

Exception:
Unhandled Exception: StripeException(error: LocalizedErrorMessage(code: FailureCode.Failed, localizedMessage: Card details not complete, message: Card details not complete, stripeErrorCode: null, declineCode: null, type: null))

I used Kotlin 1.5.0 version

WidgetsFlutterBinding.ensureInitialized();
Stripe.publishableKey = 'my key';
Stripe.merchantIdentifier = 'merchant.flutter.stripe.test';
Stripe.urlScheme = 'flutterstripe';
await Stripe.instance.applySettings();

Code for confirming payment:

final retrievedIntent = await Stripe.instance.retrievePaymentIntent(clientsecret);

final billingDetails = BillingDetails(
name: "Asif Taj",
email: '[email protected]',
phone: 'my number’,
address: Address(
city: 'Houston',
country: 'US',
line1: '1459 Circle Drive',
line2: '',
state: 'Texas',
postalCode: '77063',
),
); // mo/ m

await Stripe.instance.confirmSetupIntent(
Paymentid ,
PaymentMethodParams.card(
billingDetails: billingDetails
),
);

It shows the same exception here as well card details not completed.

final paymentIntent = await Stripe.instance.confirmPayment(
retrievedIntent.id.toString(),
PaymentMethodParams.card(
billingDetails: billingDetails
),
);

If i don’t confirm the payment then it will moved here and give the error card details not completed.

I believe there is some issue in the plugin because when I created intent in APP and did payment via sheet it got successful but same process didn't work when i make the payment via payment intent that i have created with node.js. But this payment method works with node.js

Home this make sense.

This didn't work both on android and ios.

Exceptions:

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: StripeException(error: LocalizedErrorMessage(code: FailureCode.Failed, localizedMessage: Card details not complete, message: Card details not complete, stripeErrorCode: null, declineCode: null, type: null))
E/flutter ( 2508): #0 ResultParser.parse (package:stripe_platform_interface/src/result_parser.dart:16:7)
E/flutter ( 2508): #1 MethodChannelStripe.confirmSetupIntent (package:stripe_platform_interface/src/method_channel_stripe.dart:109:7)
E/flutter ( 2508):
E/flutter ( 2508): #2 Stripe.confirmSetupIntent (package:flutter_stripe/src/stripe.dart:282:27)
E/flutter ( 2508):
E/flutter ( 2508): #3 _PaymentsScreenState.build. (package:zegret/view/Checkout/payment.dart:287:39)
E/flutter ( 2508):

@axiftaj axiftaj added the needs triage Needs triage label Dec 31, 2021
@remonh87 remonh87 self-assigned this Jan 6, 2022
@remonh87
Copy link
Member

remonh87 commented Jan 6, 2022

When you link a card to the customer the customer still needs to fill confirm the card details (cvc code and expire date etc). Check https://github.com/flutter-stripe/flutter_stripe/blob/main/example/lib/screens/others/setup_future_payment_screen.dart for more details. You can use either the CardField widget or the PaymentSheet (the latter has a nicer user experience in my opinion).

@remonh87 remonh87 closed this as completed Jan 6, 2022
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